jquery - How to get the "index" of a draggable element? -
for sortable element, use ui.item.index()
. there equivalent draggable elements?
$('.elem').draggable({ start: function(event, ui){ //how "index" of ui.item? } });
just use jquery.index() anywhere else:
$('.elem').draggable({ start: function () { var myindex = $(this).index(); $(this).text('i #' + myindex); } });
here's fiddle.
Comments
Post a Comment