jQuery Selectors and Filters - dummies

By Andy Harris

Part of JavaScript & AJAX For Dummies Cheat Sheet

Part of jQuery’s power is based on its ability to select particular sections of the page. This table includes several commonly used selectors and filters.

Selector/Filter Searches for…
$("element") Any HTML element.
$("#elementID") Any element with the given ID.
$(".className") Any element with the given class name.
:header Any header tag (h1, h2, h3, and so on).
:animated Any element that is currently being animated.
:contains(text) Any element that contains the indicated text.
:empty The element is empty.
:parent An element that contains some other element.
:attribute=value The element has an attribute with the specified value.
:Input, :text, :radio, :image, :button,
Matches on the specific element type (especially useful for
form elements that are all variations of the input tag).