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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.