【发布时间】:2011-12-11 11:16:43
【问题描述】:
我有一个无序列表,其中列表项包含指向图像的链接。我的代码当前遍历列表项,获取 href,在 div banner-holder 中创建一个新的图像容器并添加 src 属性。
我想做的是跳过第一个列表项,因为我已经在 banner-holder 中拥有该图像并且我不想添加它两次。
谢谢。
$('li').each(function ()
{
var bigImage = $(this).find('a.main-img').attr('href');
$('<img/>').attr('src', bigImage).appendTo('#banner-holder');
});
【问题讨论】:
标签: jquery image function html-lists