I want to select a subset of tds from a table.
I know before hand what the indexes are, but they are effectively random (not odd or even indexes, etc).
For i
I wrapped VisioN's filter method into a jQuery plugin:
$.fn.eqAnyOf = function (arrayOfIndexes) { return this.filter(function(i) { return $.inArray(i, arrayOfIndexes) > -1; }); };
So now usage is nice and clean:
var $tds = $('table td').eqAnyOf([1, 5, 9]);