Chapter 4. Working with properties, attributes, and data

This chapter covers

  • Getting and setting element attributes
  • Working with element properties
  • Storing custom data on elements

Everyone who has approached software development for the first time has learned a very important lesson: even huge and complex software consists of a mix of elementary instructions. Summing numbers, counting items, and iterating over elements are just a few examples of these basic operations. In the same way, you can create a nice visual with jQuery by manipulating attributes, properties, classes, styles, and so on.

You can manipulate attributes and properties of elements with JavaScript’s native functions, but some tasks aren’t as easy as you’d like them to ...

Get jQuery in Action, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.