I am taking advantage of something and wanted to make sure that what I am doing is correct.
I using the jQuery .on() api attach an event handler function for form.submit events within the document.
What I have discovered is that the the event handler is not executed if I directly access the form to submit it; however, if I use jQuery to create it's form object, the event handler is executed.
For example if I use:
Expand|Select|Wrap|Line Numbers
- <select id="SelectedMasterID" onchange="this.form.submit();" name="SelectedMasterID">
- <!-- options -->
- </select>
However, if I use the following it will not be bypassed:
Expand|Select|Wrap|Line Numbers
- <select id="SelectedMasterID" onchange="$(this).parents('form').submit();" name="SelectedMasterID">
- <!-- options -->
- </select>
According to the .on() api documentation:
The .on() method attaches event handlers to the currently selected set of elements in the jQuery object.So, am I correct in thinking that
this.form.submit()
will always bypass the event handler?Thanks,
-Frinny