I have three connected sortable lists using JqueryUI: list1, list 2 and list 3. Particular items in List 1 have the class number. If these number items are dragged then they can only be dropped into list 2 BUT NOT into list 3. How do I find out which list I am about to drop it in?
$("#list1").sortable({
start: function(event, ui) {
beforeStop: function (event, ui) {
if ($(ui.item).hasClass("number")) {
//Check which list is targeted
//If List 3 then
//$(List 3).sortable('cancel');
//End If
}
}
}
});
You could check the item on the update event. From the jQuery documentation:
Something like this might work for you:
From what I understand of your situation, I don’t think it would be necessary to check for the class
number, since you can allow sorting for only the items that have classnumber.Edit:
If you don’t want to be able to drag into list 3 at all, you can just not make it sortable from when the page loads and have the other lists sortable: