I'm farily new to jquery and can't figure out how to build a series of span elements based on the number of divs in a container. I'm trying to use the jquery.flow plugin to create a slider on a page in my site. My CMS will kick out all the images in divs, but I'd like to automatically create the necessary span elements. I'm trying to make this dynamic, allowing the user to create as many slider images as necessary. The code structure is shown here:
<div id="myController">
<span class="jFlowControl">No 1 </span>
<span class="jFlowControl">No 2 </span>
<span class="jFlowControl">No 3 </span>
<span class="jFlowControl">No 4 </span>
</div>
<div id="mySlides">
<div>First Slide</div>
<div>Second Slide </div>
<div>Third Slide </div>
<div>Fourth Slide </div>
</div>
I'd can easily generate the list of divs inside the container div. I'd like to write a piece of jquery that will add one span for each of the divs. If I have 4 divs, then the script will create the 4 spans. If I have 10 divs, then the script will create 10 spans.
Thanks for any help!