Not sure, but from an id/class point of view, any page id should be unique, so your "order" identifier if it is to be used on many TDs, should really be a class="order". So if you're just picking up a single id, there's no need to iterate over, is there?
Anyway - I replicated your test and find worked fine within each for me.