Javascript examples for DOM HTML Element:Input Text
Input Text disabled Property - Find out if a text field is disabled or not:
<!DOCTYPE html> <html> <body> First Name: <input type="text" id="myText" value="Mickey"><br> <button onclick="disableTxt()">Disable Text field</button> <button onclick="enableTxt()">Enable Text field</button> <script> function disableTxt() {/* w ww . j av a 2s.c om*/ document.getElementById("myText").disabled = true; var v = document.getElementById("myText").disabled; console.log(v); } function enableTxt() { document.getElementById("myText").disabled = false; var v = document.getElementById("myText").disabled; console.log(v); } </script> </body> </html>