Iterate over links on the site and click javascript / jquery links

I try to skip all the links on the site and autocline some links in order to vote for what I still have:

    function x(){
        for(var e in document.getElementsByTagName("a")){ 
            alert(e.getAttribute("href"))
            e.click;
        }
    }

This is currently not working. I think this may be due to something as simple as /; key, I'm an absolute newbie to javascript, so please bear with me. I assume that you get a drift of what I want to do, I performed this task in another language, but still have not gotten the right to vote, I believe that this can be connected with the site using jquery? My question is: how can I get this simple script to start and 2) Is there any other click method for jQuery that I can use instead of what I have there? 3) How to check 6 specific URLs and click only these. I also need to execute this from a browser using javascript: xxx_code_here

Any ideas?

thank

+5
source share
6 answers

jquery

$("a").each(function ()
{
   $(this).trigger('click');//for clicking element
   var href = $(this).attr("href");
});

trigger:

+2

JQuery :

$("a").each(function(){
    alert($(this).attr('href'));
    $(this).trigger('click');
};
+1

pure-javascript

function x() { // Please find a better name!
    for(var a in document.getElementsByTagName("a")) {
        alert(a.href);
        a.click(); // Careful, IE only, see comments
    }
}

jQuery :

function x() {
    $("a").each(function (i, a) {
        alert(a.href);
        a.click();
    });
}
0
$("a").each(function ()
{
    window.location.href = $(this).attr('href');
    // $(this).trigger('click');
});
0
javascript: var validUrls = ["http://targetsite.com/votefraud1","http://targetsite.com/votefraud2","http://targetsite.com/votefraud3"];

function x() { 
 for(var a in document.getElementsByTagName("a")) {
   if(validUrls.indexOf(a.href) != -1){
      window.open(a.href,'');
    }
  }
}

x();

, , click ,

0

Each link opens in a new tab.

$("a").each(function ()
{
    window.open($(this).attr('href'),"_blank");
});

If for the first time the links do not open this time, you need to enable pop-ups on the web page.

0
source

All Articles