Also, on a second note... Isn't this exactly the required method of attaching functions to events if you want to specifically unbind them later on? I was on the assumption that in order to unbind certain functions from events you need to pass in the exact same function pointer as a parameter that you used when binding.
Like $('#clickelem').bind('click',myAlert); and then unbinding elsewhere: $('#clickelem').unbind('click',myAlert); Works perfectly. If you use, however: $('#clickelem').bind('click',function(){ alert('foo!'); }); and then $('#clickelem').unbind('click',function(){ alert('foo!'); }); It does not work, since those are actually 2 different functions created on the fly (although identical). Plus using the first method is often much cleaner for the code, too. -- Suni ----- Original Message ----- From: Juha Suni To: jQuery Discussion Sent: Wednesday, March 28, 2007 11:49 AM Subject: Re: [jQuery] bind two events to same function $('#hoverelem').hover(myFunction,myFunction);
_______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/