我需要能够添加 li /锂到我页面上某个div内的每个UL.这是我的代码: div class="sfmg-thumbs-wrapper" style="width: 67px;"ulli class="active"a href="#"img width="20" height="20" alt="Photo Title Here 1" src="images/temp/
<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>
我需要在每个div的末尾插入一个LI标签.这是我使用的jquery:
$('.sfmg-thumbs-wrapper').each(function() { $('.sfmg-thumbs-wrapper').find('.sfmg-thumbs-wrapper li:last').appendTo('<li class="info"/>'); });
这不起作用.在此先感谢您的帮助!
你有没有试过这个(不需要每个人)?$('.sfmg-thumbs-wrapper ul').append('<li class="info"/>')