JQuery Sortable with multiple sections within the same view

I ran into an issue the other day where multiple sortable regions were dynamically created within the same view, all with the same class structure. After running

> $(“.the-class”).sortable({…})

I noticed that only the first sortable region was actually sorting. To resolve this issue iterate over the class and call sortable on each individual element. For instance:

$(“.the-class”).each(function(){
$(this).sortable({…});
});

Leave a Reply

Your email address will not be published. Required fields are marked *