Bind an event handler to multiple elements jQuery?

Posted by Alex on Stack Overflow See other posts from Stack Overflow or by Alex
Published on 2010-05-08T05:38:24Z Indexed on 2010/05/08 5:48 UTC
Read the original article Hit count: 187

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!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about events