O'Reilly logo

jQuery Essentials by Troy Miles

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Attributes and properties

Before we get to the methods that deal with attributes and properties, we must first discuss a bigger issue: what's the difference between an attribute and a property? They are different, but how?

When the DOM is constructed from the HTML attributes, the key-value pairs that are included in the markup are built. Most of these attributes are translated into properties, which are placed onto the DOM element node. The important thing to understand is that once the element node is constructed, properties are used to keep track of the state of the node, not the attributes. Attributes are not updated as jQuery; if they are, JavaScript changes the DOM. They represent the state of the DOM when it was first loaded, and this is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required