Jörn Zaefferer schrieb:
Mike Alsup schrieb:
> Huh? The reset event is not bound by jQuery. Are you thinking of
submit?
>
No, starting with jQuery 1.1 element events are also triggered. The
following for example will focus the first input in the page:
Yes, but those events have to be bound. The reset event is not bound
by jQuery.
jQuery does a bit more:
trigger: function(type, data, element) {
// Clone the incoming data, if any
data = jQuery.makeArray(data || []);
// Handle a global trigger
if ( !element )
jQuery.each( this.global[type] || [], function(){
jQuery.event.trigger( type, data, this );
});
// Handle triggering a single element
else {
var handler = element["on" + type ], val,
fn = jQuery.isFunction( element[ type ] );
if ( handler ) {
// Pass along a fake event
data.unshift( this.fix({ type: type, target: element }) );
// Trigger the event
if ( (val = handler.apply( element, data )) !== false )
this.triggered = true;
}
if ( fn && val !== false )
element[ type ]();
this.triggered = false;
}
},
The element[ type ](); part is particular intersting.
So the element inherent method is triggered, no matter if there is an
additional event bound or not?
-- Klaus