Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

javascript clear textarea

This page discusses - javascript clear textarea

Ads

javascript clear textarea

        

The text in any text area can be deleted or erased using Javascript. In the example below, we have created a text area  element containing some text. We have also created a button named "Clear TextArea" which calls clearTextArea() method defined in <script> </script>. It clears the value of the text area.

cleartextarea.html

<html>
<head>
<title>javascript focus input</title>
<script type="text/javascript">

function clearTextArea() {
document.textform.textarea.value='';
}

</script>
</head>
<body>
<form name="textform">
<textarea name="textarea">
This text will be removed if you click on 'Clear TextArea' button.</textarea>
</form>

<input type="button" id="name" onClick="clearTextArea();" value="Clear TextArea" /><br>

</body>
</html>

The above code will display the page like below:

Click on 'Clear TextArea' button, you will see that the text is not present in the text area.

        

Advertisements

Ads

Online Training Classes

Share on Google+Share on Google+

javascript clear textarea

Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

Ads
 

Discuss: javascript clear textarea  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads