Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5545
  • Last Modified:

How to change/access text in TEXTAREA HTML/Javascript

HOw can I modify text in text Area.  assuming there is already some text in text aria
0
mostenscer
Asked:
mostenscer
  • 2
1 Solution
 
callrsCommented:
<!-- Change text area
      2006-11-01 rs
-->
<form>
<textarea name=text1 style="width: 500px; height: 300px">
</textarea><br>
<input name=in1 value="Some text">
<input type=button value="Click to change text area" onclick="this.form.text1.value=this.form.in1.value"><br>
<input name=in2 value="Add text">
<input type=button value="Click to add to text area" onclick="this.form.text1.value=this.form.text1.value+'\n'+this.form.in2.value">
</form>

Instant Demo: http://www.sendspace.com/file/itvixp changeTextarea.htm
0
 
puneetmahajan1982Commented:
Run this code :


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body>
<form ID="Form1">
<textarea style="width: 500px; height: 300px" ID="Textarea1">
Hello
</textarea><br>

<input value="Some text" ID="Text1">
<input type=button value="Click to change text area" onclick='document.getElementById("Textarea1").value = document.getElementById("Text1").value' ID="Button1" NAME="Button1"><br>
<input value="Add text" ID="Text2">
<input type=button value="Click to add to text area" onclick='document.getElementById("Textarea1").value =document.getElementById("Textarea1").value +"\n"+ document.getElementById("Text2").value' ID="Button2" NAME="Button2">
</form>

</body>
</html>
0
 
callrsCommented:
Oops, I posted wrong link. Here's the demo: http://www.sendspace.com/file/dn3og0 changeTextarea.htm

(There's also a "Split points" link below)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now