show value in input field as read only code example Example: readonly attribute in html by javascript document.getElementById("yourID").readOnly = true;