jQuery Reference Manual - Selectors

jQuery Selectors

selector instance Select
* $("*") All elements
#id $("#lastname") elements with id="lastname"
.class $(".intro") All elements with class="intro"
element $("p") All <p> elements
.class.class $(".intro.demo") All elements with class="intro" and class="demo"
     
:first $("p:first") The first <p> element
:last $("p:last") The last <p> element
:even $("tr:even") All even <tr> elements
:odd $("tr:odd") All odd <tr> elements
     
:eq(index) $("ul li:eq(3)") The fourth element in the list (index starts from 0)
:gt(no) $("ul li:gt(3)") List elements with index greater than 3
:lt(no) $('ul li:lt(3)') List elements with index less than 3
:not(selector) $('input:not(:empty)') All non-empty input elements
     
:header $(':header') All heading elements <h1> - <h6>
:animated   All animated elements
     
:contains(text) $(':contains('W3School')') All elements containing the specified string
:empty $(':empty') All elements with no child (element) nodes
:hidden $('p:hidden') All hidden <p> elements
:visible $('table:visible') All visible tables
     
s1,s2,s3 $('th,td,.intro') All elements with matching selectors
     
[attribute] $('[href]') All elements with href attribute
[attribute=value] $('[href='#']') All elements with href attribute values equal to "#"
[attribute!=value] $('[href!='#']') All elements with href attribute values not equal to "#"
[attribute$=value] $('[href$='.jpg']') All elements with href attribute values ending with ".jpg"
     
:input $(':input') All <input> elements
:text $(':text') All <input> elements with type="text"
:password $(':password') All <input> elements with type="password"
:radio $(':radio') All <input> elements with type="radio"
:checkbox $(':checkbox') All <input> elements with type="checkbox"
:submit $(':submit') All <input> elements with type="submit"
:reset $(':reset') All <input> elements with type="reset"
:button $(':button') All <input> elements with type="button"
:image $(':image') All <input> Elements with type="image"
:file $(':file') All <input> Elements with type="file"
     
:enabled $(':enabled') All Enabled input Elements
:disabled $(':disabled') All Disabled input Elements
:selected $(':selected') All Selected input Elements
:checked $(':checked') All Selected input Elements

See Also

Tutorial:jQuery Element Selector Syntax