jQuery Disable Inputs version 1.4, 1.5 & 1.6

This is how you can disable input fields using jQuery. Note that in old versions of jQuery this can be done in different ways.

jQuery 1.6.x

Nowdays, to change the disabled property you should use the .prop() function.

$input.prop('disabled', true);
$input.prop('disabled', false);

jQuery 1.5.x and below

The .prop() function doesn’t exist, but .attr() does similar.


Set the disabled attribute:


To enable again:


In any version of jQuery

You can always rely on the actual DOM object and is probably a little faster than the other two options if you are only dealing with one element:

// assuming an event handler thus 'this'
this.disabled = true;

The advantage to using the .prop() or .attr() methods is that you can set the property for a bunch of selected items.