I have two functions.
1
function foo(elems){ elems.each(function(){ }); } foo($('selector1,selector2')); // calling foo 2
function bar(elem1,elem2){ // some logic } bar($('selector1'),$('selector2)); // calling bar However, now I need to use foo() inside bar().
function bar(elem1,elem2){ foo(?); // I'm stuck here. I want to pass both elem1 and elem2 as single jquery object } So I tried $(elem1,elem2) but it only includes elem1. So what should I do, so that I can pass elem1 and elem2 as a single jquery object which I'll iterate over in foo() by .each()