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!
To clarify let us extract the
selectorstring into a variable:the above is similar to what you have written.
this is the correct way to use the interface. Note that it is a comma separated list of selector in a single string.