---
title: "Drag and Drop elements using jQuery"  
description: "In this article I’m going to explain how to create a drag and drop element using jQuery."  
author: "Vijay Shukla"  
published: 2012-12-17  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/1079/drag-and-drop-elements-using-jquery  
category: "jquery"  
tags: ["jquery"]  
reading_time: 2 minutes  

---

# Drag and Drop elements using jQuery

In this article I’m going to explain how to create a drag and drop [element using jQuery](https://www.mindstick.com/forum/158691/how-can-you-change-the-css-styles-of-an-element-using-jquery).\

Through this coding we can drag any item which is under the list and drop any other place.

```
<!doctype html>
 <html>
<head>
    <title>::mindstick Sorting in jQuery::</title>
    <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
    <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
    <style>
    #sort
           {
                list-style-type: none;
                margin: 100;
                padding: 10;
                width: 100%;
           }
    #sort li
             {
                margin: 2px 2px 2px 2px;
                padding: 0.5em;
                padding-left: 2em;
                font-size: 2em;
                height: 18px;
              }
    </style>
    <script>
    $(function() {
        $( "#sort" ).sortable();
        $( "#sort" ).disableSelection();
    });
    </script>
</head>
<body>
   <ul id="sort">
                <li>ADO.NET</li>
                <li>ASP.NET</li>
                <li>PHP</li>
                <li>Java</li>
                <li>jQuery</li>
   </ul>
</body>
</html>
```

##### Sortable ()

Sortable [method in jQuery](https://www.mindstick.com/forum/33895/how-to-use-append-method-in-jquery) Enable a group of DOM [elements](https://www.mindstick.com/forum/1440/wpf-button-with-multiple-text-elements) to be Sortable. Click on and drag an element to a new spot within the list, and the other items will adjust to fit.

##### disableSelection ()

disableSelection method is use to in jQuery script for make an unselect able text in your application.

##### After that coding we can get below output on your browser:

![Drag and Drop elements using jQuery](https://www.mindstick.com/mindstickarticle/0d7d73b0-8d06-4d8e-a60e-16d1606689a0/images/d8f21bd2-7f97-4e64-b5c3-58543a303f79.png)

---

Original Source: https://www.mindstick.com/articles/1079/drag-and-drop-elements-using-jquery

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
