I’m using JqueryUI to drag and drop to a sortable list. Suppose coll-selected-list is the list I want to drop on, I want to check if the current item I’m dropping exists in the list already. If it does, I wish to prevent the drop. Is this possible? My code is below:
$("#coll-selected-list").sortable({
receive: function (event, ui) {
//alert($(ui.item).text());
var itemName = $(ui.item).text();
if ($("#coll-selected-list li:contains(" + itemName + ")")) {
//DO Nothing
}
}
});
You can use the cancel() method: