Javascript examples for DOM HTML Element:Textarea
The disabled property sets or gets whether a text area should be disabled.
This property reflects the HTML disabled attribute.
Set the disabled property with the following Values
Value | Description |
---|---|
true|false | Sets whether a text area should be disabled |
A Boolean, returns true if the text area is disabled, otherwise it returns false
The following code shows how to disable a text area:
<!DOCTYPE html> <html> <body> Address:<br> <textarea id="myTextarea"> Main Street//from www .java 2 s . co m New York</textarea> <p>Click the button to disable the text area.</p> <button onclick="myFunction()">Disable Textarea</button> <script> function myFunction() { document.getElementById("myTextarea").disabled = true; } </script> </body> </html>