How can i change the id of div when drag is stop 开发者_Python百科using JQuery.
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 :)
$("myDiv").attr('id', 'newid'); ??
精彩评论