Mega Code Archive

 
Categories / JavaScript Tutorial / Form
 

Textarea defaultValue

The defaultValue property contains the text between the beginning and ending tags. This property is often used to reset areas to their default values after a user has modified them. <html>     <head>     <script language="JavaScript">     <!--     function resetForm(){       document.myForm.myTextArea.value = document.myForm.myTextArea.defaultValue;     }     -->     </script>     </head>     <body>     <b>Edit the text in the following text box:</b>     <P>     <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 Reset" name="myButton"              onClick="resetForm()">     </form>     </body>     </html>