Programming Tips - jQuery: How to set and get the enable, disabled and readonly tag properties

Date: 2019sep9 Update: 2025sep25 Language: javaScript Library: jQuery Q. jQuery: How to set and get the enable, disabled and readonly tag properties A. In jQuery 1.6+ Setting:
$('#id').prop('disabled', false); // Make it enabled $('#id').prop('disabled', true); // Make it disabled $('#id').prop('readonly', true); // Make it read-only $('#id').prop('readonly', false); // Make it changeable $('#id').prop('checked', true); // Make it checked $('#id').prop('checked', false); // Make it unchecked
Getting:
const isDisabled = $('#id').prop('disabled'); const isReadonly = $('#id').prop('readonly'); const isChecked = $('#id').prop('checked');