Open In App
Related Articles

jQuery UI Draggable destroy() Method

Improve Article
Improve
Save Article
Save
Like Article
Like

The jQuery UI consists of GUI widgets, visual effects, and themes implemented using jQuery, CSS, and HTML. jQuery UI is great for building UI interfaces for the webpages. The jQuery UI Draggable destroy() method is used to remove the draggable functionality completely. 

Syntax:

$( ".selector" ).draggable( "destroy" );

Parameters: This method does not accept any parameter.

CDN Link: First, add jQuery UI scripts needed for 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: The below example illustrates the Draggable destroy() method in jQuery UI.

HTML




<!doctype html>
<html lang="en">
<head>
    <link rel="stylesheet"
          href=
    <script src=
    </script>
    <script src=
    </script>
    <style>
        h1 {
            color: green;
        }
        .container{
            width: 320px;
        }
        #left-div {
            float: left;
        }
        #right-div{
            float: right;
        }
        #left-div,#right-div
        {
            width: 150px;
            height: 150px;
            text-align: center;
            border: 2px solid black;
        }
    </style>
    <script>
        $(function() {
            $( "#left-div" ).draggable();
            $( "#left-div" ).draggable('enable');
            $( "#right-div" ).draggable();
            $( "#right-div" ).draggable('destroy');    
        });
    </script>
</head>
      
<body>
    <center>
        <h1>GeeksforGeeks</h1>
        <h3>jQuery UI Draggable destroy() Method</h3>
        <div class="container">
            <div id="left-div">
                <h3 class="gfg">I'm Enable</h3>
            </div>
            <div id="right-div">
                <h3 class="gfg">I'm Destroy</h3>
            </div>
        </div>
    </center>
</body>
</html>


Output:

jQuery UI Draggable destroy() Method


Last Updated : 08 Dec, 2021
Like Article
Save Article
Similar Reads
Related Tutorials