Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Sortable Connected Lists</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <link rel="stylesheet" href="https://code.jquery.com/ui/1.13.2/themes/base/jquery-ui.css"> <script src="https://code.jquery.com/ui/1.13.2/jquery-ui.min.js"></script> <style> .kanban-col{float:left;width:200px;margin-right:20px;background:#fafafa;border:1px solid #eee;border-radius:6px;padding:10px;min-height:160px;} .kanban-col ul{list-style:none;margin:0;padding:0;min-height:120px;} .kanban-col li{margin:0 0 6px 0;padding:0.5em 1em;background:#fff;border:1px solid #ccc;cursor:move;} .ui-state-highlight{height:1.8em;line-height:1.2em;background:#fff3d6;border:1px dashed #f6c343;} </style> </head> <body> <p>Drag cards between the two columns.</p> <div class="kanban-col"> <h4>To Do</h4> <ul id="todo" class="connectedSortable"> <li class="ui-widget-content">Write docs</li> <li class="ui-widget-content">Fix bug #42</li> </ul> </div> <div class="kanban-col"> <h4>Done</h4> <ul id="done" class="connectedSortable"> <li class="ui-widget-content">Setup project</li> </ul> </div> <script> $(function(){ $("#todo, #done").sortable({ connectWith: ".connectedSortable", placeholder: "ui-state-highlight" }).disableSelection(); }); </script> </body> </html>
Output