Input Text readOnly Property - Find out if a text field is read-only or not: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Text

Description

Input Text readOnly Property - Find out if a text field is read-only or not:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>
Name: <input type="text" id="myText">

<button onclick="myFunction()">Test</button>

<script>
function myFunction() {// ww  w.j a  v  a2s. c  o  m
    var v = document.getElementById("myText").readOnly;
    console.log(v);
}
</script>

</body>
</html>

Related Tutorials