Geril
Geril

Reputation: 159

Dojo script simulate click on link with specific ID

is it possible to write script in DoJo that will automatically click on link with specific id? I have link:

<a href="overlay1" id="callMe" /> When you click on this link some dojo library will generate overlay with specific video etc. this is not important. So I need script that will call this link when you open page. How will it looks? So: On load page find link with id callMe, simulate click on it.

Upvotes: 1

Views: 1761

Answers (1)

Thomas Kagan
Thomas Kagan

Reputation: 438

You can use dojo/dom to select the link by it's ID and then call the links click() function

code example:

require(['dojo/dom', 'dojo/domReady!'], function(dom){
   var callMe_link = dom.byId("callMe");

   callMe_link.click();

})

working example: http://jsfiddle.net/kagant15/Ls41gecu/

Upvotes: 3

Related Questions