How can i change the id of div when drag is stop using JQuery.
this is not working in my scenario
Xulfee
2010-07-16 12:08:57
xulfee - perhaps nick's will work (also, mine should have read: $('#myDiv').attr('id', 'newid'); i'd missed out the # symbol. try it again..
jim
2010-07-16 12:11:29
+1
A:
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 :)
Nick Craver
2010-07-16 11:24:26