Re-numbering With jQuery

I needed this to do a quick re-numbering of featured items in a slider on the homepage because I was always changing the PHP code and the numbering got messed up.

Code to do a quick re-numbering of ‘a span’ items in a unordered list:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
jQuery(document).ready(function()
{
    renumber_featured_nav();
});
 
function renumber_featured_nav()
{
    var ftabscount = 1;
    jQuery("li.ftab a span").each(function()
    {
        jQuery(this).html(ftabscount);
        ftabscount++;
    });
}

Leave a Reply