What Constitutes an Attribute or Property in jQuery 1.6.1

jQuery 1.6.1 RC1 was released today, helping resolve the .attr() backwards compatibility issue along with a few other fixes.

jQuery.com released a nice chart on what .attr() and .prop() should be used for going forward from jQuery 1.6+. I thought I’d publish this for future reference. Note that all properties can still be accessed via 1.6.1, but not necessarily via 1.6.

According to jQuery.com the .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.

Attribute Property
accesskey async
align autofocus
class checked
contenteditable location
draggable multiple
href readOnly
id selected
label
rel
src
tabindex
title
type
width
Advertisements