Code Editor
Web Browser
Learn
JavaScript and the DOM

jQuery Selectors

With plain JavaScript we selected an HTML element with this code:

document.getElementsByClassName('skillset');

With jQuery we can select the same element with:

$('.skillset');
  1. We can wrap any CSS selector, like class, id, or tag, with $('.example-class') to select it with jQuery.

  2. The selectors jQuery uses are the exact same as CSS selectors. For instance, if there's an element with a class of supporting-text, you could select it with $('.supporting-text'). Another example, if an element had an id of 'header', you could select it with $('#header').

Report a Bug
If you see a bug or any other issue with this page, please report it here.