💲 jQuery Essentials

jQuery Selectors: The Complete Guide with Examples

By The CodeCraft Team··7 min read
jQuery dollar selector syntax on dark background

jQuery selectors borrow CSS syntax and add a few super-powers of their own. If you maintain a legacy project or want fast DOM scripting without writing your own helpers, they're still excellent.

Basic selectors

$("#header")         // by id
$(".card")            // by class
$("input[type=text]") // by attribute
$("ul > li")          // direct child

Filter selectors

$("li:first")
$("li:last")
$("li:eq(2)")
$("tr:even")
$("input:checked")

Form selectors

  • :input — all form fields
  • :text, :password, :checkbox, :radio
  • :disabled, :enabled, :selected

Chain methods on selections

$(".card").addClass("active").fadeIn(200).find("h3").text("Hello");

Frequently asked questions

Is jQuery still used in 2026?

Yes — millions of legacy sites and admin panels still use it. Vanilla JS is preferred for new projects, but jQuery isn't going away.

External references

Enjoyed this article?

Share it with a fellow developer or explore more tutorials in our blog.

More articles

Related articles