means find each list item (li) that is a child (>) of an element with an ID of
selected-plays (#selected-plays).
$('#selected-plays li:not(.horizontal)').addClass('sub-level');
we are getting every list item (li) that:
1. Is a descendant of an element with an ID of selected-plays
(#selected-plays), and
2. Does not have a class of horizontal (:not(.horizontal)).
jquery also use XPath selectors,like
$('a[@title]') means select all links that has a title attribut
$()'div[ol]') means get all div elements that contain an ol element
$('a[@href^="mailto:"]') means get all anchor elements(a) with an href attributes([@href]) that begin with mailto(^="mailto:")
$('a[@href$=".pdf"]') means get all links with a href attribute that ends with .pdf
$('a[@href*="mysite.com"]') means get all internal linkes,
Jquery's custom selectors
$('div.horizontal:eq(1)') means select the second item from a matched set of divs with a class of horizontal
$('tr:odd')
$('tr:even')
$('td:contains("henry")')
No comments:
Post a Comment