How to enable/disable input in javascript?

Disable input in javascript:

// find input element
let txtName = document.getElementById("txtName");
// disable input element
txtName.disabled = true;

Enable input in javascript:

// find input element
let txtName = document.getElementById("txtName");
// enable input element
txtName.disabled = false;

Javascript Demo: https://jsbin.com/hokusaqola/edit?html,output