readonly attribute in html by javascript
snippet in javascript

readonly attribute in html by javascript

user6621

document.getElementById("yourID").readOnly = true; 

set readonly in javascript

user1194

document.getElementById("myText").readOnly = true;