How to use Jquery Drag and Drop?

a simple example of drag-and-drop functionality using jQuery.

<!DOCTYPE html>

<title>jQuery Drag and Drop Example</title>
.sortable {
list-style-type: none;
padding: 0;
margin: 0;

li {
background-color: #f2f2f2;
padding: 10px;
border: 1px solid #ccc;
margin: 5px;
cursor: pointer;

<ul id="sortable-list" class="sortable">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>

<script src=""></script>
<script src=""></script>
$(document).ready(function () {
update: function (event, ui) {
var order = $("#sortable-list").sortable("toArray");
console.log("New order:", order);