[jQuery] Re: assign event handler to multiple events

2009-04-15 Thread Tom Worster
On 4/14/09 6:21 PM, "James" wrote: > > $('.things').bind('focus change click', function() { > // your code here > }); ah ha! thanks. that is tidy. tom

[jQuery] Re: assign event handler to multiple events

2009-04-14 Thread Leeoniya
if you still need the performance of event delegation (live), you should make the handling function separately and assign it using several "live"s. eg: function handleStuff(e) { // do things } $("div > p, #nav a").live("click", handleStuff).live("keydown", handleStuff); be aware that live() d

[jQuery] Re: assign event handler to multiple events

2009-04-14 Thread James
$('.things').bind('focus change click', function() { // your code here }); (Note that this doesn't work for $.live(), as you can only bind one event for that.) On Apr 14, 10:40 am, Tom Worster wrote: > i can assign a handler to one event type thus: > > $('.things').focus(function(){ >