Lesson 17
jQuery Selection
In this lesson, you will start gaining an understanding of jQuery and the way in which it can simplify interaction with the DOM.
jQuery is an open-source library written entirely in JavaScript. Although it is intended to simplify interaction with the DOM, it does not do anything that could not be achieved with the DOM API. In fact, it uses the DOM API to perform its operations.
The following are the main reasons why jQuery is used in so many web applications:
- It provides an intuitive and easy-to-learn API for performing the most common tasks in website development. For instance, the selection API you will use in this lesson is based on CSS selectors.
- It provides genuine cross-browser support and hides some of the quirks that exist in the DOM API implementations of certain browsers (most notably, older versions of IE).
- It is very easy to write plugins to enhance the capabilities of jQuery, and there are extensive libraries of freely available plugins on the Internet.
- The jQuery website contains extremely good documentation, and there is a wide variety of help available on the Internet if you encounter problems.
jQuery is not the only library designed to assist with DOM interaction, but it has become the de facto standard, and has a higher market share than all its competitors combined. Therefore, if you are going to learn one JavaScript library, it makes sense for it to be jQuery.
Loading jQuery
Before using jQuery, you need to import it into ...
Get HTML5, JavaScript, and jQuery 24-Hour Trainer 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.