was looking for an easy way to bind functions to objects when using jquery, and couldn't find any information about it. is there a reason for not implementing this? i found it very useful when using prototype.
i've made my own implementation for jquery...it declares a bind function in the global jQuery object...first argument to the function is the method to bind, the second argument should be the object to bind to (if empty will bind to jQuery), and followed by any number of arguments to be passed to the function... $.bind = function() { var _func = arguments[0] || null; var _obj = arguments[1] || this; var _args = $.grep(arguments, function(v, i) { return i > 1; }); return function() { return _func.apply(_obj, _args); }; }; example usage: setTimeout($.bind(func, MyObject), 5000); -- View this message in context: http://www.nabble.com/a-bind-function-inspired-by-prototype%27s-Function.prototype.bind-implementation-tf3121778.html#a8649435 Sent from the JQuery mailing list archive at Nabble.com. _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/