Is there any way to simulate a click of a button with the id 'id' in Javascript or jQuery? Thanks
Asked
Active
Viewed 536 times
-7
-
Either http://api.jquery.com/trigger or http://api.jquery.com/click can be used to raise a click event – Rory McCrossan Jun 05 '18 at 08:36
1 Answers
0
You could use:
document.getElementById("id").click();
You would still need to bind this to an event. My question would be why do you want to simulate the button click? Why not call the function behind the button instead?

Luke Walker
- 511
- 5
- 19