how to make a field read only in javascript code example Example: readonly attribute in html by javascript document.getElementById("yourID").readOnly = true;