I need to be able to add an <li> </li> to each UL within a certain div on my page. Here is the code I have:
<div class="sfmg-thumbs-wrapper" style="width: 67px;">
<ul>
<li class="active"><a href="#"><img width="20" height="20" alt="Photo Title Here 1" src="images/temp/portfolioImage1.jpg"></a></li>
<li class=""><a href="#"><img width="20" height="20" alt="Photo Title Here 2" src="images/temp/portfolioImage2.jpg"></a></li>
<li class=""><a href="#"><img width="20" height="20" alt="Photo Title Here 3" src="images/temp/portfolioImage3.jpg"></a></li>
<li class=""><a href="#"><img width="20" height="20" alt="Photo Title Here 4" src="images/temp/portfolioImage4.jpg"></a></li>
</ul>
</div>
<div class="sfmg-thumbs-wrapper" style="width: 67px;">
<ul>
<li class="active"><a href="#"><img width="20" height="20" alt="Photo Title Here 1" src="images/temp/portfolioImage1.jpg"></a></li>
<li class=""><a href="#"><img width="20" height="20" alt="Photo Title Here 2" src="images/temp/portfolioImage2.jpg"></a></li>
<li class=""><a href="#"><img width="20" height="20" alt="Photo Title Here 3" src="images/temp/portfolioImage3.jpg"></a></li>
<li class=""><a href="#"><img width="20" height="20" alt="Photo Title Here 4" src="images/temp/portfolioImage4.jpg"></a></li>
</ul>
</div>
I need to insert a LI tag to the end of each div. Here is the jquery I was using:
$('.sfmg-thumbs-wrapper').each(function() {
$('.sfmg-thumbs-wrapper').find('.sfmg-thumbs-wrapper li:last').appendTo('<li class="info"/>');
});
This is not working. Thanks in advance for any help!
Did you try just this (no each needed)?