I am still a novice when it comes to using jQuery and it has been a while since I've developed in the web.
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:
The above code will bypass the event handler method.
However, if I use the following it will not be bypassed:
This is actually beneficial to my situation because in some cases I want to bypass the method attached to the submit event.
According to the .on() api documentation:
So, am I correct in thinking that
Thanks,
-Frinny
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:
Code:
<select id="SelectedMasterID" onchange="this.form.submit();" name="SelectedMasterID"> <!-- options --> </select>
However, if I use the following it will not be bypassed:
Code:
<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.
this.form.submi t() will always bypass the event handler?Thanks,
-Frinny
Comment