cycling jQuery_Succinctly | Page 45

// By index. alert($('li:nth-child(1)').text()); // Alerts "1". // By even. alert($('li:nth-child(even)').text()); // Alerts "246810". // By odd. alert($('li:nth-child(odd)').text()); // Alerts "13579". // By equation. alert($('li:nth-child(3n)').text()); // Alerts "369". // Remember this filter uses a 1 index. alert($('li:nth-child(0)').text()); // Alerts nothing. There is no 0 index. })(jQuery); Selecting elements by searching attribute values using regular expressions When the jQuery attribute filters used to select elements are not robust enough, try using regular expressions. James Padolsey has written a nice extension to the filter selectors that will allow us to create custom regular expressions for filtering. I have provided a code example here, but make sure you also check out the article on http://james.padolsey.com for all the details. Sample: sample33.html