I recently upgraded from jQuery 1.5.1 to 1.6.2. This upgrade affected code I have been using to enable or disable an element (such as a button).
Original Code
The above code worked in all major browsers until I upgraded to jQuery 1.6.2; however, after upgrading the element would not re-enable again by simply setting the disabled attribute to an empty string.
Solution
Alternate Solution
I chose to go with the removeAttr solution since that seems more likely to eliminate differences from one browser to the next.
Original Code
// disable
$("#btnSubmit").attr('disabled', 'disabled');// enable
$("#btnSubmit").attr('disabled', '');The above code worked in all major browsers until I upgraded to jQuery 1.6.2; however, after upgrading the element would not re-enable again by simply setting the disabled attribute to an empty string.
Solution
// disable
$("#btnSubmit").attr('disabled', 'disabled');// enable
$("#btnSubmit").removeAttr('disabled');Alternate Solution
// disable
$("#btnSubmit").attr('disabled', true);// enable
$("#btnSubmit").attr('disabled', false);I chose to go with the removeAttr solution since that seems more likely to eliminate differences from one browser to the next.
No comments: