Depends on what you want to do next with your vars.
You can simply define them as one:
var $a = $('#a, #b'); $a.click()
Or use them separately:
$([].concat($a.toArray()).concat($b.toArray())).click(function () { console.log(this) });
EDIT
Updated code.
.. Fredrick
source share