jQuery :gt selector with relative indexing -
i have <dl>
list containing multiple <dd><ol>...</ol></dd>
lists, each number of <li>
elements. i'm trying select first 2 elements of each <ol>
list.
i can achieve using
$("dl dd ol").each(function(){ $elems = $("li:gt(2)",$(this)); });
i'm curious, possible perform same operation without using $.each
(i.e. using selectors)? i've tried $("dl dd ol > li:gt(2)")
seems :gt
not index relatively parent. there, currently, way using selectors?
you can use find
method:
$("dl dd ol").find("li:gt(2)").css('color','#f00');
Comments
Post a Comment