0

For example if i have code like this:

javascript:

var inputs = document.getElementsByClassName('SomeClass'); 
for(var i=0; i<inputs.length;i++) { 
   inputs[i].click(); 
}

that can click on all inputs in page with "SomeClass" is it possible to do it for link with specific class and open them all in new tabs?

idmean
  • 14,540
  • 9
  • 54
  • 83
user3710700
  • 301
  • 1
  • 4
  • 11

2 Answers2

0
element.trigger('click');

but it is not supported on all browser. take a look at this:

https://stackoverflow.com/a/8991665/2696626

and this for handler:

http://api.jquery.com/click/

Edit:

try this code in this site:

$("a").each(function(){ $(this).click(); });
Community
  • 1
  • 1
ibrahimyilmaz
  • 2,317
  • 1
  • 24
  • 28
0

Element.trigger() is jQuery. You should be looking into dispatchEvent (most browsers) and fireEvent (IE). Or as suggested you can start using jQuery and use trigger.

Russell Bevan
  • 334
  • 1
  • 13