+ -
当前位置:首页 → 问答吧 → jquery如何遍历某个层下所有的超链接,为什么从没有人回答我的问题?

jquery如何遍历某个层下所有的超链接,为什么从没有人回答我的问题?

时间:2011-04-16

来源:互联网

$("#layout_display").children("a").each(function(){
alert($(this).attr("src"));
});


为的是取层layout_display下的所有超链接地址,为什么没反应啊

作者: kericw   发布时间: 2011-04-16

$("#div a")
就可以了,而且超链接的链接地址是 href 不是 src

作者: kvgnt   发布时间: 2011-04-16

+1
引用 1 楼 kvgnt 的回复:
$("#div a")
就可以了,而且超链接的链接地址是 href 不是 src

作者: licip   发布时间: 2011-04-16

如果是children的话 。
$("#div > a")

作者: zell419   发布时间: 2011-04-16

a标记哪有src 属性,晕

作者: pt1314917   发布时间: 2011-04-16

$("#layout_display a").each(function(){
alert($(this).attr("src"));
});

这样就可以了吧?或者find

作者: Anlige   发布时间: 2011-04-16