<!DOCTYPE html>
<html>
<body>

<input type="button" id="myBtn" value="My Button">

<p>Click the button below to disable the button above.</p>

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

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

</body>
</html>