Reputation: 303
I added onclick using dojo to one of my divs
dojo.connect(dojo.byId("button1"), "onclick", function () {
alert('clicked');
}
I now need to call the exact same function dynamically in some other part of Javascript, I tried
dojo.byId("button1").onclick();.
It did not work. Please help me in resolving this issue.
Upvotes: 0
Views: 2109
Reputation: 1667
This works for me:
dojo.query("#button1").onclick(function(e){
alert('clicked');
})
dojo.byId('button1').click();
Here's a JSFiddle with it.
Upvotes: 1