O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

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

Using the jQuery Selector to Find HTML Elements

Unlike JavaScript, jQuery allows you to find HTML elements in countless ways using selectors. Yes, just like CSS selectors. In fact, most jQuery selectors are based on the CSS selectors, thus providing a more seamless transition between the two.

As demonstrated by the phrases in the upcoming sections, jQuery selectors make it easy to select just about any group of HTML elements. Keep in mind that jQuery selectors return jQuery objects that represent a set of DOM objects, not a direct array of DOM objects.

jQuery selector syntax is straightforward. Once the jQuery library is loaded, simply use $(selector). For example:

$("#myElement")

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