Selecting Elements

As you saw in the prior section, the DOM provides methods such as getElementById and querySelector for accessing element nodes. jQuery exposes similar methods but with a more straightforward and powerful syntax for doing DOM selection. It allows more finite selection based on element, ID, class, or CSS. It also allows you to filter your selection. Finally, it allows you to select a single node or multiple nodes using the same selection syntax.

The jQuery Object and $

Like the JavaScript document object for working with the DOM, jQuery provides the object jquery for calling the many methods of jQuery. This includes doing selection. jQuery also provides the shortcut $ as a replacement for jquery. This means that jquery.hide() ...

Get Microsoft Visual Studio 2015 Unleashed, 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.