Xulfee
Xulfee

Reputation: 986

Draggable Jquery

How can i change the id of div when drag is stop using JQuery.

Upvotes: 0

Views: 204

Answers (2)

Nick Craver
Nick Craver

Reputation: 630597

You can use the stop event, like this:

$("#draggable").draggable({
   stop: function() {
     this.id = "newID"; //calc whatever the new ID is, assign here
   }
});

You can test it here, in the stop callback, this refers to the dragged element, so do with it what you want :)

Upvotes: 2

jim tollan
jim tollan

Reputation: 22485

$("myDiv").attr('id', 'newid'); ??

Upvotes: 1

Related Questions