I'm pretty sure your code would cause an infinite loop.
It should probably be (untested):
jQuery.fn._bind = jQuery.fn.bind;
jQuery.fn.bind = function(names,action) {
var self = this;
jQuery.each(names.split(/\s*,\s*/),function() {
self._bind(this,action); // self._bind(), not self.bind()
};
return this;
};
On 3/27/07, Blair Mitchelmore <[EMAIL PROTECTED]> wrote:
Or if you wanted to hack jQuery a bit for some syntactic sugar:
jQuery.fn._bind = jQuery.fn.bind;
jQuery.fn.bind = function(names,action) {
var self = this;
jQuery.each(names.split(/\s*,\s*/),function() {
self.bind(this,action);
};
return this;
};
That code might not work as intended, but the principle is valid.
-blair
Aaron Heimlich wrote:
> function doSuperCoolStuff(evt) {
> // do super cool stuff...
> }
>
> $('[EMAIL PROTECTED]"submit"]').bind("mouseover",
> doSuperCoolStuff).bind("mouseout", doSuperCoolStuff);
>
> On 3/27/07, *Josh Nathanson* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> What is the syntax to bind two events to the same function?
>
> I want to do something like
>
> $("[EMAIL PROTECTED]").bind("mouseover,mouseout", function() {
> stuff here
> });
>
> But it doesn't work. TIA
>
> -- Josh
>
>
> _______________________________________________
> jQuery mailing list
> [email protected] <mailto:[email protected]>
> http://jquery.com/discuss/ <http://jquery.com/discuss/>
>
>
>
>
> --
> Aaron Heimlich
> Web Developer
> [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> http://aheimlich.freepgs.com <http://aheimlich.freepgs.com>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/