Domanda

I hope this makes sense but here goes... I have a div which is draggable and has a helper on it, now what I need to do is change the name of the id when it is dropped on the stage, at the moment it gets the ui-draggable ui-draggable-dragging class and I can't seem to add an id to it. Thanks in advance

È stato utile?

Soluzione

You could use the stop function of draggable.

JS:

$( ".draggable" ).draggable({
    stop: function() {
       $(this).attr('id','dragged');
    }
 });

HTML

<div id="dragme" class="draggable">
    test
</div>

Here is a Fiddle: http://jsfiddle.net/d1m5n/H5Utr/

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top