Can I do something like the below where I can have multiple classes trigger an event?
$('a.red a.blue a.green').click(function(event)
{
});
You can specify any number of selectors to combine into a single result. This multiple expression combinator is an efficient way to select disparate elements. The order of the DOM elements in the returned jQuery object may not be identical, as they will be in document order.
So far we have covered only three standard jQuery Selectors.
Yes, you can use the comma as separator.
$('a.red, a.blue, a.green').click(function(event) {});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With