admin管理员组文章数量:1419183
this website wants me to click ALL the links on the page (there's about 2000).
This is the code for each link:
<a href="#" id="27426879" class="unfollow">UNFOLLOW</a>
the ID changes all the time depending on the link.
Is it possible to supply me the javascript code to write into the console of google chrome to click ALL the "a" tags with the class of "unfollow" at once? thanks :)
this website wants me to click ALL the links on the page (there's about 2000).
This is the code for each link:
<a href="#" id="27426879" class="unfollow">UNFOLLOW</a>
the ID changes all the time depending on the link.
Is it possible to supply me the javascript code to write into the console of google chrome to click ALL the "a" tags with the class of "unfollow" at once? thanks :)
Share Improve this question edited Jan 13, 2013 at 20:55 Pointy 414k62 gold badges595 silver badges629 bronze badges asked Jan 13, 2013 at 20:54 Rahul KhoslaRahul Khosla 44910 silver badges21 bronze badges 1-
3
Inject jQuery then
$('a.unfollow[href="#"]').click();
– Musa Commented Jan 13, 2013 at 20:58
3 Answers
Reset to default 4How about?
var links = document.querySelectorAll("a.unfollow[href=#]");
for (var i = 0; i < links.length; ++i) {
links[i].click();
}
Sure is:
[].forEach.call(document.querySelectorAll('a.unfollow'), function (link){
link.click();
});
Demo
You could do it using a plain for
loop as well, but I just found it faster to do it this way.
Thanks I used chat room this code works easy: $('a.unfollow').click()
本文标签: cssJavascript Help For Chrome Console Clicking All links websiteStack Overflow
版权声明:本文标题:css - Javascript Help For Chrome Console? Clicking All links website - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745296161a2652092.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论