0

I have an anchor somewhere and need to call it's onclick event programmatically from JavaScript. The site does not have jQuery.

The solution needs to be "cross-browser"

I tried:

document.getElementById('anchorID').onclick();

or

document.getElementById('anchorID').click();

but nothing gets fired.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
SF Developer
  • 5,244
  • 14
  • 60
  • 106

1 Answers1

0

you can try raiseEvent, but I am not sure if it is cross-browser.

bart s
  • 5,068
  • 1
  • 34
  • 55