Frage

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.

War es hilfreich?

Lösung

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;
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top