11
Aug 11

Disabling an element in jQuery 1.6

Last week, I had to update the jQuery to the last version 1.6.2 because the version 1.5.2 didn”t work properly in IE9. After that upgrade and some more tests. I discovered some problems disabling some elements. After trying to find out why the hell the disabling was not working I found the answer. With the release of jQuery 1.6, the recommendation has been to generally start using prop() where you used to use attr().

So is necessary to substitute

$(''.control'').attr(''disabled'', ''disabled'');
$(''.control'').removeAttr("disabled");

 

with

$(''.control'').prop(''disabled'', ''disabled'');
$(''.control'').removeProp("disabled");