I have two classes: Class1 and Class2.
For now, I have 2 function calls calling the same MyFunction function:
$('.Class1').click(function () { MyFunction() });
$('.Class2').click(function () { MyFunction() });
How do I rewrite this to say "when there's a click on Class1 and on Class2 call MyFunction".
Thanks.
$('.Class1, .Class2').click(function () { MyFunction() })
to bind a click event to 2 different classes
$('.Class1, .Class2').click()
this would mean if Class1 OR Class2
is clicked, fire the 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