DIGIT-ARC read-only archive · snapshot: July 23, 2026

Creating a button to select everything in a text area.

7 posts · originally from https://geek.digit.in/community/threads/creating-a-button-to-select-everything-in-a-text-area.75315/

krates
krates Original post #1
Dec 10, 2007 at 12:34 PM
Here is a simple script sometimes you want to highlight verything in a text field so that the user can copy it or something.
script goes here


<form>
<center>
<input type=button value=”Highlight All” onClick=”javascript:this.form.textarea.focus();this.form.textarea.select();”>

<br>
<textarea NAME=”textarea” ROWS=10 COLS=30 WRAP=VIRTUAL>
Put all the content over here.
Thanks kushagra
</textarea>
</center>
</form>




just notice one the textarea name is textarea and
javascript:this.form.textarea.focus();this.form.textarea.select();

Change every textarea word with the name of your text area

and for a google type by just clicking on textarea everything gets selected you can do

<form>
<center>


<textarea NAME="textarea" ROWS=10 COLS=30 WRAP=VIRTUAL onClick="javascript:this.form.textarea.focus();this.form.textarea.select();">

Put all the content over here.

Thanks kushagra
</textarea>
</center>
</form>


*www.easytutorial.info/?p=22

please double check for the whitespaces by mistakes


thanks
krates
Batistabomb
Dec 10, 2007 at 12:39 PM
Good programming, also it's not mandatory to post the source for every post dear
krates
krates #3
Dec 10, 2007 at 12:47 PM
he he he i am just linking to my blog and this is everything by me but i just put one link so that many users from digit came to know about my blog on which i am doing hard work :D
Batistabomb
Dec 10, 2007 at 12:50 PM
really great, you are maintaining a blog
krates
krates #5
Dec 10, 2007 at 12:57 PM
Thanks this is really hectic when you ran out of tutorials :D:D
V
vaibhavtek #6
Dec 17, 2007 at 8:52 AM
nice 1.
anand1
anand1 #7
Dec 17, 2007 at 9:11 AM
nice one