Skip to content

@pdokas /Example.js
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Add a context param to $.fn.bind()
$('h1').bind('click', function() {
this.log('clicked!');
}, console);
$('h2').bind('click', {msg: 'clicked!'}, function(e) {
this.log(e.data.msg);
}, console);
(function($) {
$.fn.oldbind = $.fn.bind;
$.fn.bind = function(type, data, handler, context) {
if (!$.isPlainObject(data)) {
context = handler;
handler = data;
data = {};
}
if (context) {
handler = $.proxy(handler, context);
}
this.oldbind(type, data, handler);
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.