how to set attribute to read only javascript code example Example: javascript set readonly property document.getElementById('InputFieldID').readOnly = true;