[jQuery] Re: onfocus filter question

2007-06-01 Thread Brandon Aaron
If you actually create a function reference instead of passing an anonymous function, they will not be duplicated. var fn = function(e) { alert('in textfield'); }; $('input.text').bind('focus', fn); In the near future, once jQuery 1.1.3 is released, you would be able to use the behavior

[jQuery] Re: onfocus filter question

2007-06-01 Thread John R
Thank you for the advice. It worked perfectly. On Jun 1, 6:28 am, Brandon Aaron [EMAIL PROTECTED] wrote: If you actually create a function reference instead of passing an anonymous function, they will not be duplicated. var fn = function(e) { alert('in textfield'); };

[jQuery] Re: onfocus filter question

2007-05-31 Thread John Resig
I think the fool-proof way would be to do something like adding a class, for example: $(input.text:not(.focused)).focus(function(){ ... }).addClass(focused); That way you can run that line as many times as you want and it'll never re-bind the focus event. --John On 5/31/07, John R [EMAIL