jQuery Tutorial


jQuery Example


jQuery References


jQuery Selectors




jQuery selectors is most important aspects of the jQuery library. jQuery library allow you to select elements in your HTML document by wrapping them in $(" ") (also you have to use single quotes), which is the jQuery wrapper. Selectors are useful and required at every step while using jQuery.

jQuery Selector Syntax

See following basic selector are explains..

Selector Description
TagName Selects all element match of given elements.
this Selects current elements.
#ID Selects element whose id is match of given elements.
.CLASS Selects element whose class is match of given elements.
* Selects all elements in the document.

Very Useful Some jQuery Element Selectors Example

Syntax Description
$("table *") Select All table Elements.
$("this") Select Current HTML element.
$("#name") Selected element with id="name".
$(".name") Selected elements with class="name".
$("[href]") Select All elements with a href attribute.

jQuery Selector Examples

$("p").hide()
The jQuery hide() function, hiding all <p> elements.

$("this").hide()
The jQuery hide() function, hiding current(this) element.

$("#div1").hide()
The jQuery hide() function, hiding whose id="div1" in the elements.

$(".div1").hide()
The jQuery hide() function, hiding whose class=".div1" in the elements.


Some Custom Selectors

Syntax Description
$(":animated") Selects elements currently being animated.
$(":button") Selects any button elements (inputs or buttons tag).
$(":radio") Selects radio buttons.
$(":checkbox") Selects checkboxes.
$(":header") Selects header elements (h1, h2, h3, etc..).

Full Reference of jQuery Selectors References Learn all jQuery Selectors References.