Get element position withing another element

Get element position withing another element

Hi

i am stuck on trying to find a way of getting the position of an element within another element. for example i would like to get the position of each td in a tr

so if i had 5 tds within a tr they would have the positions 0 1 2 3 4. which is possible to find with only one table and one set of tds by using the index function but i would like each td to return its position within its parent tr not the DOM

I hope this makes sense to someone.