views:

72

answers:

1

Hello all.

I've done some experimenting, but can't seem to successfully bind one event handler to multiple elements using jQuery. Here's what I've tried:

$('selector1', 'selector2').bind('click', function() {
        $('someSelector').removeClass('coolClass'); 
});

I've tested all my selectors, and they are all valid.

Is what I'm trying to do even possible? If so, can I do it with .live() as well?

Thanks!

+4  A: 
$('selector1, selector2').bind(...)

That works for all of mine. Treat like a css selector, not a JS array.

Gabriel
Oh awesome! Thanks a ton!
Alex
glad I could help :D
Gabriel