Chapter 2. Selecting Elements

The jQuery library harnesses the power of Cascading Style Sheets (CSS) selectors to let us quickly and easily access elements or groups of elements in Document Object Model (DOM).

In this chapter, we will cover:

  • The structure of the elements on a web page
  • How to use CSS selectors to find elements on the page
  • Custom jQuery extensions to the standard set of CSS selectors
  • The DOM traversal methods, which provide greater flexibility for accessing elements on the page

Understanding the DOM

One of the most powerful aspects of jQuery is its ability to make selecting elements in the DOM easy. The DOM serves as the interface between JavaScript and a web page; it provides a representation of the source HTML as a network of objects ...

Get Learning jQuery - Fourth 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.