jQuery eq() loop -


can me this?

$(document).ready(function(){      $("ul.fam:eq(0) li:eq(2)").addclass("redbold");     }); 

in code, there way loop or increment '0' value in -> $("ul.fam:eq(0) ? making 0,1,2,3,4,5 , on... , stop loop example when reaches '3'

thank you.

you can use :lt() (less index) selector, this:

$(document).ready(function(){   $("ul.fam:lt(4) > li:nth-child(3)").addclass("redbold");     }); 

you can test out here.

this same selecting :eq(0) through :eq(3). there's :gt() selector other way around...you can combine both or .slice() range.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -