Question

I spent an hour looking for it with no luck... I need to run a nextUntil() in jQuery. Basically I wish to say: whether it's var1 or var2 that jQuery finds first, nextUntil(suchvar);

I tried assigning this way but no success:

var either = var1 || var2;
...nextUntil(either);

ps:I omitted the rest of the code for sake of simplicity.

Was it helpful?

Solution

Assuming your vars are storing selectors, you can separate them by a comma to form a selector which matches either selector:

var afoo = 'a.foo';
var abar = 'div.bar ul';

var either = afoo + ', ' + abar;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top