<!DOCTYPE html>
<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>
</html>