1. ホーム
  2. javascript

[解決済み] How to change the Content of a <textarea> with JavaScript

2022-04-21 21:59:05

Question

How would I change the content of a <textarea> element with JavaScript?

I want to make it empty.

How to solved?

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: