Correct me if I am wrong, but seems to me jQuery event handling is completely separate from the javascript event handling. I know that the order of executing jQuery and javascript event handlers themselves is undefined, but can the assumption be made that all javascript handlers will execute before jQuery ones?
In the example given in an answer to this question that seems to be the case.
Also, is there any preference on executing inline javascript event handlers in respect to bound ones?
For clarification, I am asking all of this because I encountered a problem where I have an inline event handler on onClick
event of an <a>
element that calls the submit()
method of an enclosing form. Just before submitting the form, I want to dynamically add some hidden inputs
to the form. Right now I am doing this:
var preSubmit = function preSubmit()
{
// add inputs
}
var oldSubmit = form.submit;
form.submit = function newSubmit()
{
preSubmit();
oldSubmit.call(form, arguments);
}
But I'm really wondering if there is a more elegant way and I really need some clarification on this.