Jeditable Accidentally Triggering On Draggable On Nested Items
Solution 1:
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!
Solution 2:
oftomh, you should try and get a hold of the Event
object within the drop handler, and then try to call event.preventDefault()
, event.stopImmediatePropagation()
or event.stopPropagation()
luckily for you you're on jQuery. Doing so cross-browserly with vanilla JS is annoying.
Solution 3:
Ripper,
One possible workaround is to use the double click event for your jEditable component.
To do this, just initialize the jEditable object with the following option:
event: 'dblclick'
Solution 4:
You could try setting contenteditable="false" on these items. Just try adding this attribute in the relevant html tag and see what happend.
Post a Comment for "Jeditable Accidentally Triggering On Draggable On Nested Items"