I have the following code that allows you to drag and drop elements on a page and, when successfully dropped, runs a method called saveRatings that passes the identifiers of the elements.
$('.draggable').draggable({
revert: true
});
$('.droppable').droppable({
drop: function( event, ui ) {
draggedID = ui.draggable.attr("id");
droppedID = $(this).attr("id");
Global.showLoader('Saving...');
quiz1.saveRatings(draggedID, droppedID);
}
});
The plan is that after a successful deletion, it will remove the item being dragged and remove the droppable class from the discarded item, to prevent other items from being dropped as well:
saveRatings: function ( choiceId, ratingId ) {
$('div#' + choiceId).hide();
$('div#' + ratingId).removeClass('ui-droppable');
$('div#' + ratingId).removeClass('droppable');
$('div#' + ratingId).addClass('done');
}
Part of the removal works fine, just like deleting classes, but the element still allows you to delete others on it ... although I removed the droppable and ui-droppable classes from the element ...
, ? , ( ). , .