|
thanks, you're absolutely right. I was just having a moment there. I also put incorrect code in my sample html. you can't call a submit event on an input element. that should have been a form element.
when I use the traditional model to register the event like this example:
element.onsubmit = doSomething;
"element" is the object and "onsubmit" is like a property of the object. "doSomething" is the function. The function doSomething will get executed every time the event in triggerd and if doSomething returns "false" then the onsubmit of the element will equal false for that instance and thus nothing happens. If I put opening and closing parentheses like this:
element.onsubmit = doSomething();
The function is called right away and the onsubmit equals whatever the result is. Every time the event is triggered it will still equal the initial value of whatever was the result of the function and if it equaled false the form will never get submitted.
|