Musings
Public · Protected · Private
Jquery select tags
-
2012-04-26 11:17ALL $("*") selects all elements. type selection $("div") selects all <div> elements. type with class $("div.details") selects all <div> elements with class="details". type with id $("div#details") selects the first <div> elements with id="details". All types in use now $(":animated") selects all elements that are currently animated. all types $(":button") selects all <button> elements and <input> elements of type="button". for alternating items $(":even") selects even elements. $(":odd") selects odd elements. current one $(this) Selects the current HTML element type -- > class and nth item $("div#details:first") Selects the first <div> element with id="details" class selection $(".details") Selects all elements with class="details" $("#details") Selects the first element with id="details" $("ul li:first") Selects the first <li> element of the first <ul> $("ul li:first-child") Selects the first <li> element of every <ul> ones that have a particular attribute $("[href]") Selects all elements with an href attribute $("[href$='.gif']") Selects all elements with an href attribute that ends with ".gif" $("[href='#']") Selects all elements with an href value equal to "#" $("[href!='#']") Selects all elements with an href value NOT equal to "#"
This blog is frozen. No new comments or edits allowed.