Disable enable input field using jQuery

Disable enable input field, jquery disable enable input, disable enable form element, disable input field based on selection, Disable or enable an input field with jQuery, How to disable/enable input field on click, How to disable an input field using Javascript, disable input field javascript.

Disable enable input field with simple one line jQuery code. You can enable or disable input form field runtime.

Same code can be use for enable or disable button element when you want to disable submit button on Ajax start.

jQuery disable enable input field code:

For enable and disable input field just need to change disabled attribute value.
You can change selector( #eleId ) as per your code structure.

//FOR DISABLE ELEMENT
$('#eleId').attr('disabled', true);

//FOR ENABLE ELEMENT
$('#eleId').attr('disabled', false);

Also possible same thing using prop() function From jQuery 1.6 or >> version.
(Below snippets added after valuable user comment)

//FOR DISABLE ELEMENT
$('#eleId').prop('disabled', true);

//FOR ENABLE ELEMENT
$('#eleId').prop('disabled', false);

jQuery disable enable input field example:

Text field :


Password field :


Button :

2 Comments

Comments are closed.