Good day! There is a task to sort the blocks inside one block. Html has the following structure:

<div class="sortable"> <div class="file-preview"></div> <div class="file-preview"></div> 

It is necessary that divs with the class file-preview can be sorted, there can be other divs in sortable

I do now

 $( ".sortable" ).sortable({ placeholder: "file-preview" }); 

But it does not work, tell me, please. how to solve this problem.

    1 answer 1

    You need to use the items parameter: https://jqueryui.com/sortable/#items

     $(document).ready(function() { $(".sortable").sortable({ items: ".file-preview" }); $( ".sortable div" ).disableSelection(); });