In jQuery you can select two elements by id like: $('#elem, #elem2');
BUT
What if you have cached the elem and elem2, and what to apply the same method/function to them both?
i.e.
$elem = $('#elem'); $elem2 = $('#elem2');
This obviously wont work:
$($elem, $elem2)
Thanks!
Use the add method:
$elem.add($elem2).show();
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