jQuery submit event not fired when calling DOM submit method

前端 未结 1 736
滥情空心
滥情空心 2020-12-21 11:35

When I use the DOM form submit method to submit a form, the jQuery submit event handler isn\'t called, even though w3c says: \"It performs the same action as a submit button

相关标签:
1条回答
  • 2020-12-21 11:57

    No, calling the form's submit() method does not trigger the submit event so none of the event handlers will get triggered.

    The submit event will be fired only when the user triggers it via a button click or any such actions.

    submit event

    The form's onsubmit event handler (for example, onsubmit="return false;") will not be triggered when invoking this method from Gecko-based applications. In general, it is not guaranteed to be invoked by HTML user agents.

    0 讨论(0)
提交回复
热议问题