Thanks Ralph! I'll give that a try :)
On Apr 9, 10:13 am, Ralph Whitbeck <ralph.whitb...@gmail.com> wrote: > You can use .each to iterate through each div element and increment the > classname or ID via it's index. > > $("div").each(function(i) { > $(this).addClass("classname" + i); > > }); > > http://docs.jquery.com/Core/each > > HTH > Ralph > > On Thu, Apr 9, 2009 at 9:37 AM, brian <bally.z...@gmail.com> wrote: > > > That seems like you're fighting against the convention. Why create a > > zillion classes when these same divs already have an incremented ID? > > (The ID being the proper place to do this sort of thin, in the 1st > > place) > > > On Thu, Apr 9, 2009 at 1:31 AM, Brain Lava <nic...@brainlava.com> wrote: > > > > I'm really new to jQuery and have been struggling with a concept that > > > I would think is pretty simple but I can't seem to find anything > > > online that does what I need. > > > > I'm using NextGen Gallery for Wordpress and I would like to assign an > > > incremental class to each div that the gallery outputs. For example > > > the gallery gives me the following code: > > > > <div id="ngg-gallery-1" class="ngg-galleryoverview"> > > > <div id="ngg-image-99" class="ngg-gallery-thumbnail-box"></div> > > > <div id="ngg-image-55" class="ngg-gallery-thumbnail-box"></div> > > > <div id="ngg-image-95" class="ngg-gallery-thumbnail-box"></div> > > > </div> > > > > What I would like to do is replace the append class of the interior > > > divs with a number that automatically increments by 1: > > > <div id="ngg-gallery-1" class="ngg-galleryoverview"> > > > <div id="ngg-image-99" class="ngg-gallery-thumbnail-box-1"></div> > > > <div id="ngg-image-55" class="ngg-gallery-thumbnail-box-2"></div> > > > <div id="ngg-image-95" class="ngg-gallery-thumbnail-box-3"></div> > > > </div> > > > > I've seen this done in carousel scripts but I can't seem to figure out > > > how they do it. > > > > Any help would be greatly apprecaited.