Form submitted using submit() from a link cannot be caught by onsubmit handler
问题 Surprised, I am encountering this weird issue while submitting form from JS. Issue: Consider a simple form submitted using two ways from a submit button and an anchor link <form method="POST" action="page.html" name="foobar" id="test"> <input type="text" /> <input type="submit" /> </form> <a href="#" onclick="document.getElementById('test').submit();">click me</a> Function catching the submit event document.getElementById('test').onsubmit = function() { // Same result with // * document