How to write a jQuery selector with multiple :eq's in single expression?
I believe that you could do the following and it should return all dom elements that match:
$('div:eq(0), div:eq(1), div:eq(5)')
You could then iterate over the results returned, hope this helps.
Using an each
loop - elegant and not repetitive:
$.each([0, 1, 5], (_, n) => {
$('div').eq(n);
});
Last I checked, this technique performs best:
$('div').filter(':eq(0), :eq(1), :eq(5)');