jeditable accidentally triggering on Draggable on nested items

draggable, javascript, jeditable, jquery, jquery-ui

Solution

UPDATED 2: use children()

DEMO 2: http://jsbin.com/izaje3/2

in responce 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 sake, you can also take advantage by using the handle method!

http://jqueryui.com/demos/draggable/#handle

Problem

I'm using jquery-ui's draggable for drag-and-drop, and jeditable for inline editing. When I drag and drop an element that's also editable, right after it's dropped jeditable kicks in and pops into 'edit mode'. How can I disable this behavior? Edit - the problem happens because of netsting - see this example. I also added draggable to the mix to make the example more realistic (the actual real problem is in this site that I'm working on) Note - even though this question has an accepted answer because of the bounty rules, the problem is still not resolved for me.

Original source