Edit This Code:
<!DOCTYPE html>
<html>
<body>

<input type="month" id="myMonth">

<p>Click the button to set the month field to read-only.</p>

<p><strong>Tip:</strong> To see the effect, try to type something in the month field before and after clicking the button.</p>

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

<p><strong>Note:</strong> input elements with type="month" are not supported in Internet Explorer or Firefox.</p>

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

</body>
</html>


Result:
Try it Yourself - © w3schools.com