Find out if a number field is read-only or not:
var x = document.getElementById("myNumber").readOnly;
Click the button to find out if the number field is read-only or not.
<!DOCTYPE html> <html> <body> <input type="number" id="myNumber" value="2" readonly> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {// www .jav a2 s .c o m var x = document.getElementById("myNumber").readOnly; document.getElementById("demo").innerHTML = x; } </script> </body> </html>