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,246
  • 8
  • 52
  • 81
user3710700
  • 191
  • 1
  • 3
  • 10

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,232
  • 22
  • 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