Find out if a text field is read-only or not:
var x = document.getElementById("myText").readOnly;
Click the button to find out whether the text field is read-only.
<!DOCTYPE html> <html> <body> Name: <input type="text" id="myText" readonly> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from www . j a v a2s. c o m var x = document.getElementById("myText").readOnly; document.getElementById("demo").innerHTML = x; } </script> </body> </html>