Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Textarea select()

The select() method selects the text in the text area. <html>     <head>     <script language="JavaScript">     <!--     function selectText(){       document.myForm.myTextArea.select();       document.myForm.myTextArea.focus();     }     -->     </script>     </head>     <body>     <form name="myForm">       <textarea name="myTextArea" rows=6 cols=50>       Here is some text in my text area.       </textarea>     <input type=BUTTON value="Click to Select Text" name="myButton" onClick="selectText()">     </form>     </body>     </html>