$("#mydiv").click(my_func, {'abc' : 123}); (old)
http://code.jquery.com/jquery-1.4.2.jsmy_func = function(event) { alert(event.data); }
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +Note that the data parameter is no longer passed as an extra parameter:
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( fn ) {
return fn ? this.bind( name, fn ) : this.trigger( name );
};
if ( jQuery.attrFn ) {
jQuery.attrFn[ name ] = true;
}
});
http://code.jquery.com/jquery-1.7.js
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.bind( name, data, fn ) :
this.trigger( name );
};
No comments:
Post a Comment