<html>
<body>
First Name: <input type="text" id="myText" value="Mickey"><br>
<button onclick="disableTxt()">Disable Text field</button>
<button onclick="undisableTxt()">Undisable Text field</button>
<script>
function disableTxt() {
document.getElementById("myText").disabled = true;
}
function undisableTxt() {
document.getElementById("myText").disabled = false;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_text_disabled3 by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 03:17:20 GMT -->
</html>