I am working on a wordpress navigation menu and trying to simlpy (of course, dynamically) add number inside a span tag for each menu li item.
So I created a "top menu" using the wordpress custom menu function then I used a simple jquery function to add a "span" tag inside each tag like so:
$("#top .menu ul li a").prepend("<span></span>");
This generated the following HTML:
<ul>
<li><a href=""><span></span>Menu Item</a></li>
<li><a href=""><span></span>Menu Item</a></li>
<li><a href=""><span></span>Menu Item</a></li>
<li><a href=""><span></span>Menu Item</a></li>
</ul>
Thats exactly what I want as step #1 Now, what I am trying to get is a simple jquery function which will dynamically add a following number inside each divs maybe using a variable or something. The out put needs to be:
<ul>
<li><a href=""><span>1</span>Menu Item</a></li>
<li><a href=""><span>2</span>Menu Item</a></li>
<li><a href=""><span>3</span>Menu Item</a></li>
<li><a href=""><span>4</span>Menu Item</a></li>
</ul>
etc.. etc..
should be a very simple jquery function. just can't find it. any suggestions?
Thanks a lot!
