<!DOCTYPE html>
<html>
<body>

Password: <input type="password" id="myPsw">

<p>Click the button to disable the password field.</p>

<button onclick="myFunction()">Try it</button>

<script>
function myFunction() {
    document.getElementById("myPsw").disabled = true;
}
</script>

</body>
</html>