I have a form and a textarea field in it. I need to make it editable, and I don't know how.
<textarea id="note" class="input" type="text" name="note">Suggest changes</textarea>
When I inspect elements, its readonly attribute is already false, but it won't let me change anything.
I've tried:
document.getElementsByTagName("textarea")[0].readonly = false;
$("#note").prop('readonly', false);
$("#note").removeAttr('readonly');
None of those help.
The readonly attribute is a boolean attribute. When present, it specifies that a text area should be read-only. In a read-only text area, the content cannot be changed, but a user can tab to it, highlight it and copy content from it.
By default, a textarea is editable. So you must have made something that make it uneditable.
The <textarea> element also accepts several attributes common to form <input> s, such as autocomplete , autofocus , disabled , placeholder , readonly , and required .
The <textarea> readonly attribute in HTML is used to specify that the textarea element is read-only.
The problem is here
document.getElementsByTagName("textarea")[0].readonly = false;
It should be
document.getElementsByTagName("textarea")[0].readOnly = "false";
Or also in your case
document.getElementById("note").readOnly = "false";
Try
$("#note").attr("readonly", false);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With