-
Child Filter Selectors
Selector Example Description :first-child $(“p:first-child”) Selects all <p> elements that are the first child of their parent. :last-child $(“p:last-child”) Selects all <p> elements that are the last child of their parent. :nth-child(n) $(“p:nth-child(3)”) Selects all <p> elements that are the 3rd child of their parent. :only-child $(“p:only-child”) Selects all <p> elements that are the only child of their parent. :first-of-type $(“p:first-of-type”) Selects all <p> elements…
-
Basic Filter Selectors
Selector Example Description :first $(“p:first”) Selects the first <p> element. :last $(“p:last”) Selects the last <p> element. :even $(“tr:even”) Selects all even <tr> elements, zero-indexed. :odd $(“tr:odd”) Selects all odd <tr> elements, zero-indexed. :eq() $(“tr:eq(1)”) Select the 2nd <tr> element within the matched set, zero-based index. :not() $(“p:not(:empty)”) Select all <p> elements that are not empty. :lt() $(“ul li:lt(3)”) Select all <li> elements at an index less than three…
-
jQuery Selectors
jQuery SelectorsOrder by Alphabet This section contains a comprehensive list of selectors belonging to the latest jQuery JavaScript library. All the selectors are grouped into categories. Basic Selectors Selector Example Description * $(“*”) Selects all elements. #id $(“#foo”) Selects all elements with the id=”foo”. .class $(“.bar”) Selects all elements with the class=”bar”. element $(“p”) Selects all <p> elements. selector1,…