jQuery – Get a childs relative position
When processing sortables etc. Its handy to be able to get the index of individual items. Heres how you find the position of an li within a list:
var position = $item.parent().find('> li').index($item) + 1; |
When processing sortables etc. Its handy to be able to get the index of individual items. Heres how you find the position of an li within a list:
var position = $item.parent().find('> li').index($item) + 1; |
Leave a Reply