I’ve done some Googling and found some pretty complex solutions, but is there a simple way of getting jQuery to reverse an element index.
Currently
$('.elementClass').index(this);
Will give me the position of the clicked element within the class “elementClass” but I need this reversed! For example, I have 5 < span > elements in a row, if the 4th one is clicked, I want the return to be 1, not 3 (the first one being returned as 0)
1 Answer