You should avoid using each since it is so slow and returns a DOM object instead of jQuery object (when you want a jQuery object). Part of the reason each is so slow is it fires off a function call on each iteration. Instead I suggest going back to the for loop and using .eq() instead. That way you only have a function call for the eq rather than the loop iteration + the jQuery object create.