jQuery :gt selector with relative indexing
I have a <dl> list containing multiple <dd><ol>...</ol></dd> lists, each
with some number of <li> elements. I'm trying to select the last 3
elements of each <ol> list.
I can easily achieve it by using
$("dl dd ol").each(function(){
$elems = $("li:gt(2)",$(this));
});
I'm curious, is it possible to perform the same operation without using
$.each (i.e. only using selectors)? I've tried $("dl dd ol > li:gt(2)")
but it seems that :gt does not index relatively to the parent. Is there,
currently, any way to do this using only selectors?
jsFiddle
No comments:
Post a Comment