Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Textarea onSelect

The onSelect event handler is fired when the text in the area is highlighted. <html>     <head>     <script language="JavaScript">     <!--     function setText(){       document.myForm.myTextArea2.value = document.myForm.myTextArea1.defaultValue;     }     -->     </script>     </head>     <body>     <form name="myForm">       <textarea name="myTextArea1" rows=2 cols=50 onSelect='setText()'>       Here is some text in my text area.       </textarea>       <br>       <textarea name="myTextArea2" rows=2 cols=50>       </textarea>     </form>     </body>     </html>