How to loop alternate elements in JQuery

How to loop alternate elements in JQuery ?

I see it has each function which loops each elements . But I want every alternate elments to loop starting from an index.

is it possible in JQuery ?


$.each(function (i, elem) {
 if (i % 2 == 0) {
  // do something with even elements, or leave empty if nothing needs to be done
 } else {
  // do something with odd elements, or leave empty if nothing needs to be done
 }
});

:slight_smile: