How can I deactivate an input field via JavaScript or make it read-only?

To deactivate the field:

document.getElementById("FIELD_ID").disabled = true;


To make the field readable only:

$('FIELD_ID').attr("readonly", true)