Selectors in jQuery

Get introduced to selectors and explore the different types of selectors in jQuery.

What are selectors?

jQuery selectors find or extract DOM elements using specific patterns and identifiers. The patterns for finding these elements are specified within quotes in the $() function. jQuery adopts some of these patterns from CSS selector patterns, whereas other patterns are specific to jQuery.

Types of selectors

The following types of patterns can be used in jQuery:

  • Tag name
  • Id
  • Class
  • Attribute
  • Child
  • Descendants

Based on the pattern used, the different types of selectors in jQuery are explained below.

Get hands-on with 1200+ tech skills courses.