VOOZH about

URL: https://www.geeksforgeeks.org/jquery/jquery-ui-draggable-connecttosortable-option/

⇱ jQuery UI Draggable connectToSortable Option - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

jQuery UI Draggable connectToSortable Option

Last Updated : 23 Jul, 2025

jQuery UI  is a web-based technology and consists of GUI widgets, visual effects, and themes implemented using the jQuery, JavaScript Library. jQuery UI is the best tool for building UI interfaces for the webpages. It can also be used to build highly interactive web applications or can be used to add widgets easily.

In this article, we will learn how to use the jQuery UI Draggable connectToSortable Option. This option allows the draggable to be dropped onto the specified sortable. A draggable can be dropped onto a sortable list and then becomes part of it. The default value of this option is false.

Syntax:

The connectToSortable option takes a Selector type value and the syntax is as follows.

draggable({
 connectToSortable: "#my-sortable"
});
  • Get the connectToSortable option

    var connectToSortable = $( ".selector" )
    .draggable( "option", "connectToSortable" );
  • Set the connectToSortable option

    $( ".selector" ).draggable( "option", "connectToSortable", 
     "#my-sortable" );

CDN Link: The following jQuery Mobile scripts will be needed for your project so we need to add these scripts to your project.

<link href = "https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel = "stylesheet">
<script src = "https://code.jquery.com/jquery-1.10.2.js"></script>
<script src = "https://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>

Example: This example describes the uses of the jQuery UI Draggable connectToSortable Option.

Output:

👁 jQuery UI Draggable connectToSortable Option
jQuery UI Draggable connectToSortable Option

Reference: https://api.jqueryui.com/draggable/#option-connectToSortable

Comment

Explore