Reputation: 1744
If I have a div element and I add a textarea to the innerHTML like the following:
tMessageWindow.innerHTML="<textarea rows = '22' cols='67'> Test text </textarea>"
How can I then retrieve the value of the text area?
I've tried tvalue=tMessageWindow.value and that doesn't work of course.
Upvotes: 0
Views: 59
Reputation: 1245
Add an id to the textarea (for example id="foobar") so you can then get the value by using
document.getElementById("foobar").value;
Upvotes: 1
Reputation: 101680
How about:
var tvalue = tMessageWindow.getElementsByTagName("textarea")[0].value;
Upvotes: 2