Try using .draggable("destroy") instead. I used it just fine.
You can view this method and all other methods, parameters and events in jqueryUI Draggable destroy
Update
Sorry, I thought your problem was something else. You need to change the approach, since removing an element from dom is not actually related to the fact that the element is draggable . You need to encapsulate your draggable element, such as a div with the same height and width as your draggable, and then just destroy the draggable as you like.
HTML:
<div id="conteiner"> <div class="dragConteiner"><div id="draggable1" class="draggable"></div></div> <div class="dragConteiner"><div id="draggable2" class="draggable"></div></div> <div class="dragConteiner"><div id="draggable3" class="draggable"></div></div> </div>
JQuery
$(function(){ $("#draggable1").draggable(); $("#draggable2").draggable(); $("#draggable3").draggable(); $("#draggable2").on('mouseup',function(){ alert('bye draggable!'); $(this).draggable('destroy');
CSS
.draggable{ height:50px; width:50px; background: green; } .dragConteiner{ height:50px; width:50px; margin-top:5px; } #conteiner{ margin-top:25px; margin-left:25px; }
Jsfiddle example
Kou_warch
source share