Textarea disabled Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Textarea

Description

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

Return Value

A Boolean, returns true if the text area is disabled, otherwise it returns false

The following code shows how to disable a text area:

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials