Selectors allow you to manipulate DOM elements as a group or as a single node.
jQuery Element Selectors
jQuery uses CSS selectors to select HTML elements.
$("p") selects all elements.
$("p.intro") selects all elements with class="intro".
$("p#demo") selects the first element with id="demo".
jQuery Attribute Selectors
jQuery uses XPath expressions to select elements with given attributes.
$("[href]") select all elements with an href attribute.
$("[href='#']") select all elements with an href value equal to "#".
$("[href!='#']") select all elements with an href attribute NOT equal to "#".
$("[href$='.jpg']") select all elements with an href attribute that ends with ".jpg".
No comments:
Post a Comment