jQuery Referentiemanual - Selectors

jQuery Selectors

Selectoraar voorbeeld Selectie
* $("*") Alle elementen
#id $("#lastname") Elementen met id="lastname"
.class $(".intro") Alle elementen met class="intro"
element $("p") Alle <p> elementen
.class.class $(".intro.demo") Alle elementen met class="intro" en class="demo"
     
:first $("p:first") De eerste <p> element
:last $("p:last") De laatste <p> element
:even $("tr:even") Alle eveneisen <tr> elementen
:odd $("tr:odd") Alle odden <tr> elementen
     
:eq(index) $("ul li:eq(3)") Het vierde element in de lijst (index begint bij 0)
:gt(no) $("ul li:gt(3)") Lijst van elementen met index groter dan 3
:lt(no) $('ul li:lt(3)') List elements with an index less than 3
:not(selector) $('input:not(:empty)') All non-empty input elements
     
:header $(':header') All header 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 a matching selector
     
[attribute] $('[href]') All elements with an href attribute
[attribute=value] $('[href='#']') All elements with an href attribute whose value is "#"
[attribute!=value] $('[href!='#']') All elements with an href attribute whose value is not "#"
[attribute$=value] $('[href$='.jpg']') All elements with an href attribute whose value ends 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') Alle <input> elementen met type="image"
:file $(':file') Alle <input> elementen met type="file"
     
:enabled $(':enabled') Alle geactiveerde input-elementen
:disabled $(':disabled') Alle gedeactiveerde input-elementen
:selected $(':selected') Alle geselecteerde input-elementen
:checked $(':checked') Alle geselecteerde input-elementen

Bekijk

Handleiding:jQuery Element Selector Syntax