Get the value in TextArea in JavaScript

Description

The following code shows how to get the value in TextArea.

Example


<!--from w ww.  j a  v a2s .  com-->
<!DOCTYPE html>
<HTML>
<HEAD>
<SCRIPT>

function revString(str) {
return str;
}

</SCRIPT>
</HEAD>
<BODY>
<FORM name="theForm">
Enter a text string:
<TEXTAREA name=inStr rows=5 cols=90>
</TEXTAREA>
<INPUT type=button value="Reverse String" onClick="document.theForm.results.value = revString(document.theForm.inStr.value)";>
<INPUT type=button name="theButton" value="Clear Results" onClick='document.theForm.results.value=""';>
Results<br>
<TEXTAREA name=results rows=5 cols=90>
</TEXTAREA>

</FORM>
</BODY>
</HTML>

Click to view the demo

The code above generates the following result.

Get the value in TextArea in JavaScript
Home »
  Javascript Tutorial »
    Form »
      Text Input
Javascript Tutorial Text Input
Alert non number form input in JavaScript
Get the input value for input text in JavaS...
Get the value in TextArea in JavaScript
Pass form to a function and display its val...
Set value to input text form control in Jav...
Set value to input text in JavaScript