I have an jquery script to generate a caption for images.
But now I want to count the elements with the caption an add the appropriate number as a class to the image class.
I know how I could count (.length) but how can i use the appropriate number from every element?
http://jsbin.com/ugemih/6/edit#javascript,html,live
BR
Pass a variable to the function passed to
each()and it will hold the current element’s number: