On 24/11/06, Mike Alsup <[EMAIL PROTECTED]> wrote:
> > It's actually a really small addition, just something like:
> > if ( elem[ fnName ] )
> > elem[ fnName ]();
>
> Yes, but which do you run first, the native fn or the 'on' fn? Or do
> you run them both? I think it's not quite as simple as this.
>
> Mike
How about:
if(elem["on" + fn] && typeof elem["on" + fn] == "function") {
if(elem["on" + fn]()) {
if(elem[fn] && typeof elem[fn] == "function") {
elem[fn]()
}
}
}
For instance, you call the validation function before the form is submitted.
That kind of behaviour is different (I assume) to how other frameworks
do it (which normally just submit the form when you do
$("#myform").submit()), and can be very beneficial.
That would be safer than doing $("#myform")[0].submit(), which would
just submit the form (and will still be available for use anyway).
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/