How would I change the content of a <textarea> element with JavaScript?
<textarea>
I want to make it empty.
Like this:
document.getElementById('myTextarea').value = '';
or like this in jQuery:
$('#myTextarea').val('');
Where you have
<textarea id="myTextarea" name="something">This text gets removed</textarea>
For all the downvoters and non-believers:
Here's the MSDN reference
value Property: Retrieves or sets the text in the entry field of the textArea element.
Here's the MDN reference
value DOMString The raw value contained in the control.
1.4m articles
1.4m replys
5 comments
57.0k users