Can I select two elements with Jquery at the one time?
For example I tried this but it only selected the first element:
$('.loginStaff' || '.loginClient').click(function(){
$('.login_form').toggle();
});
I also tried but this only selected the last element:
$('.loginStaff' && '.loginClient').click(function(){
$('.login_form').toggle();
});
Thanks!!! Global
Just use a comma to separate your selectors and it will match the combined results of all:
$('.loginStaff,.loginClient').click(function(){
//..
});
More info:
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