<html>
<body>
<form>
Username:<input type="text" id="usrname"><br>
Password:<input type="password" id="pwd">
</form>
<p>Click the button below to disable the password field above.</p>
<button onclick="disableElement()">Disable Password field</button>
<script>
function disableElement()
{
document.getElementById("pwd").disabled=true;
}
</script>
</body>
</html>