CHAPTER 8

image

Manipulating Elements

In this chapter, I show you how to use jQuery manipulate elements, including how to get and set attributes, how to use the jQuery convenience methods for working with classes and CSS properties, and how to get and set HTML and text content. I also show you a nice feature that allows you to associate data with elements. Table 8-1 provides the summary for this chapter.

Table 8-1. Chapter Summary

Problem Solution Listing
Get the value of an attribute from the first element in a jQuery object Use the attr method 1
Get the value of an attribute from every element in a jQuery object Use the each and

Get Pro jQuery 2.0, Second 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.