Textarea disabled Property - Disable and enable a text area: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Textarea

Description

Textarea disabled Property - Disable and enable a text area:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Address:<br>
<textarea id="myTextarea">
Main Street// w  ww  . jav a2 s .c o m
New York</textarea>
<br>

<button onclick="disableTxt()">Disable text area</button>
<button onclick="enableTxt()">Enable text area</button>

<script>
function disableTxt() {
    document.getElementById("myTextarea").disabled = true;
}
function enableTxt() {
    document.getElementById("myTextarea").disabled = false;
  }
</script>

</body>
</html>

Related Tutorials