JavaScript jQuery DOM Selectors


jQuery vs JavaScript

In 2006, John Resig made jQuery to fix browser differences and make working with HTML easier. jQuery helps with changing HTML, dealing with events, creating animations, and using Ajax. You can learn more about it at the jQuery link.

For over a decade, jQuery has been the most widely used JavaScript library globally.

After JavaScript Version 5 (2009), many jQuery functions can be accomplished using just a few lines of regular JavaScript code.


Finding HTML Element by Id

Retrieve the element with the identifier "id01":


Finding HTML Elements by Tag Name

Retrieve all <p> elements:


Finding HTML Elements by Class Name

Retrieve all elements that have the class "intro."


Finding HTML Elements by CSS Selectors

Retrieve a list containing all paragraphs (<p> elements) with the class attribute set to "intro".