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/