JQuery 1.6.1 is coming with the fixes
In a couple of days JQuery team will release a new version of jquery (1.6.1), after the community struggled the problems of the backward compatibility in the last release (1.6) .. the new release redefine the usage and the effect of it on the DOM objects of both .attr() and .prop() ,
in this version the boolean attribute manipulation with .attr() will back as it was before the 1.6 release.
lets see an example:
<input id="mychkbox" type="checkbox" checked>
the result of the previous markup is a checked checkbox as we all know =d,
but thats the property value not the attribute value cuz the attribute “checked” is not set.
lets see the .attr() results in v.1.6:
alert($("#mychkbox").attr("checked")) // result >> "" alert($("#mychkbox").prop("checked")) // true alert(document.getElementById("mychkbox").checked") // true
thats because the attribute doesn’t change when the user change its state by clicking on it., thats fine.. but look at the following code
in the coming 1.6.1 release & prior versions than 1.6:
alert($("#mychkbox").attr("checked")) // true alert($("#mychkbox").prop("checked")) // true (in 1.6.1 only) alert(document.getElementById("mychkbox").checked") // true
in the coming release the behavior of .attr() will back as it was before 1.6 just because the sake of backward compatibility.
so it will work exactly as expected but that doesn’t mean you have to keep using attr() , switch to .prop() cuz it is more faster and oriented.
it might be confusing now what we should use for what when it comes to .prop() and .attr(), so here is the best usage as the Jquery team stated:
.prop() method should be used for boolean attributes/properties and for properties which do not exist in html (such as window.location).
All other attributes (ones you can see in the html) can and should continue to be manipulated with the
.attr() method. ”
it is expected to see Jquery 1.6.1 at the end of this week, Also you can fill up the following proposal for new features to be landed in jquery 1.7.