Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

234
Views
Sortablejs drag and drop with multiple container

sortablejs is a drag and drop plugin link

How the plugin working

<div id="example3Left"> 
<div class="list-group-item"> Item 1</div>
<div class="list-group-item"> Item 2</div>
<div class="list-group-item"> Item 2</div>
</div>
<div id="example3Right">
// Element dropping block
</div>
 

    new Sortable(example3Left, {
        group: {
            name: 'shared',
            pull: 'clone' // To clone: set pull to 'clone'
        },
        animation: 150
    });
    
    new Sortable(example3Right, {
        group: {
            name: 'shared',
            pull: 'clone'
        },
        animation: 150
    });

Check below code - But I have multiple "example3Left" container so how can I use with class name instead of ID example code but not working

<div class="group group-1"> 
<div class="list-group-item"> Item 1</div>
<div class="list-group-item"> Item 2</div>
<div class="list-group-item"> Item 2</div>
</div>
<div class="group group-2"> 
<div class="list-group-item"> Item 1</div>
<div class="list-group-item"> Item 2</div>
<div class="list-group-item"> Item 2</div>
</div>
<div id="example3Right">
// Element dropping block
</div>
new Sortable($('.group).get( 0 ), {
        group: {
            name: 'shared',
            pull: 'clone' // To clone: set pull to 'clone'
        },
        animation: 150
    });

    new Sortable(example3Right, {
        group: {
            name: 'shared',
            pull: 'clone'
        },
        animation: 150
    });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you have to loop

$('.group, #example3Right').each((i, el) => {
  new Sortable(el, {
    group: {
      name: 'shared',
      pull: 'clone' // To clone: set pull to 'clone'
    },
    animation: 150
  });
})
.list-group-item{border: 1px solid #bbb;width:100px;margin:5px}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.15.0/Sortable.min.js"></script>

<div class="group group-1"> 
<div class="list-group-item"> Item 1</div>
<div class="list-group-item"> Item 2</div>
<div class="list-group-item"> Item 3</div>
</div>
<div class="group group-2"> 
<div class="list-group-item"> Item 1</div>
<div class="list-group-item"> Item 2</div>
<div class="list-group-item"> Item 3</div>
</div>
<div id="example3Right">
// Element dropping block
</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!