Sortable with index displayed?

Sortable with index displayed?


I'm attempting to display the current sort index associated with a
sortable element by updating a div with the index # in the change
event. My current implementation looks like this:
$("#sourcelist").sortable() {
change: function(e, ui) {
el = e.target;
idx = $(el).children().index(e.srcElement);
el2 = $(e.srcElement).find(".index");
el2.text(idx);
}}
This will change the number, but the changes are very inconsistent and
usually incorrect. I've also tried the same code in a few of the other
events to no avail. Thanks