-7

Is there any way to simulate a click of a button with the id 'id' in Javascript or jQuery? Thanks

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
K-Pop
  • 11
  • 1
  • 5

1 Answers1

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