[英]Jquery: Select a href link and navigate with 'each' method
Is it possible using jQuery to select one full link that is in others 'tags'? 是否可以使用jQuery选择其他“标签”中的一个完整链接?
I would like select each href link of each item ( <li>
).. 我想选择每个项目的每个href链接( <li>
)..
My idea is to use the method each
and then extract the link, for use to navigate then. 我的想法是使用的方法each
然后提取链接,用于导航即可。
This is the part of the code of the page: http://pastebin.com/3Vjib4UR 这是该页面代码的一部分: http : //pastebin.com/3Vjib4UR
Where in full code of page, there more <li>
items in the <ul>
tag. 在页面的完整代码中, <ul>
标记中还有更多<li>
项目。
PS: I would like use the script in an external plugin of firefox (Greasemonkey),and not direct in the page. PS:我想在firefox(Greasemonkey)的外部插件中使用该脚本,而不是直接在页面中。
Thanks in advance. 提前致谢。
Kind regards. 亲切的问候。
Like this? 像这样?
var arr = new Array();
$("a").each(function(){ arr.push($(this).attr("href"); });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.