Hi all,
I have several lists with images in each li
Code HTML4Strict:<article class="brand-details"> <ol> <li class="largeImg"><img src="images/brands/charnos_1.jpg" alt="Hourglass" /><span></span></li> <li><a href="images/brands/charnos_1.jpg"><img src="images/brands/charnos_1small.jpg" alt="Hourglass"></a></li> <li><a href="images/brands/charnos_2.jpg"><img src="images/brands/charnos_2small.jpg" alt="Hourglass Blush corselette"></a></li> <li><a href="images/brands/charnos_3.jpg"><img src="images/brands/charnos_3small.jpg" alt="Superfit Black"></a></li> <li><a href="images/brands/charnos_4.jpg"><img src="images/brands/charnos_4small.jpg" alt="Belle Ivory"></a></li> </ol> </article>
I want to populate each empty <span> in .largeImg (or preferably generate the span as well) with the alt text of img inside .largeImg in each list.
This populates each span with the alt text of the first image from the first list so I'm nearly there!
Code JavaScript:$(".brand-details ol li:nth-child(1)").children('span').text($(".brand-details ol li img").attr('alt'));
I always get stuck when more than one group of elements is involved!
Thanks



Reply With Quote

Bookmarks