I know about the document.form.button.click() method. However, I\'d like to know how to simulate the onclick event.
document.form.button.click()
onclick
I found this code somew
Based on Derek's answer, I verified that
document.getElementById('testTarget') .dispatchEvent(new MouseEvent('click', {shiftKey: true}))
works as expected even with key modifiers. And this is not a deprecated API, as far as I can see. You can verify on this page as well.