UPDATED 2: use children ()
DEMO 2: http://jsbin.com/izaje3/2
in response to your comment
$(function() { $('.editable').editable(); $('.draggable').draggable({ drag: function(event, ui) { $(this).children('div').removeClass('editable') }, stop: function(event, ui) { $(this).children('div').addClass('editable') } }); });β
DEMO: http://jsbin.com/ihojo/2
$(function() { $(".draggable").draggable({ drag: function(event, ui) { $(this).unbind('editable') } }); $(".editable").editable(); });
OR you can do like this:
$(function() { $('.editable').editable(); $('.draggable').draggable({ drag: function(event, ui) { $(this).removeClass('editable') }, stop: function(event, ui) { $(this).addClass('editable') } }); });
Assuming you have something like this:
<div class="draggable editable"></div>
NOTE: just for the sake of it, you can also take advantage of the handle method!
http://jqueryui.com/demos/draggable/#handle
source share