views:

17

answers:

1

Because Jquery UI tab doesn't support passing id selector to remove() tab method, and no method exists to map id to index, I have to painfully "jump hoops" to determine the index of the tab I wish to remove.

I just searched the documentation for JQuery and wasn't able to find a utility method to return an integer of the ordinal position of some child under a parent. I think I want the functional opposite of the

.eq()

traversing method (determine index, not select by index).

Does something like this exist?:

$("#parent").ordinalChild('#some-child')

This would return 0 if "some-child" is the first child, 1 for the second child, etc.

Or how do I go about obtaining this without writing a loop and counting?

+2  A: 

See index

$('#parent').children().index('#some-child');
Matt
On the main documenation page I searched each of the categories under "jQuery API Reference" three times and it's not listed! Thanks for pointing that out to me.
Pete Alvin