Open In App

jQuery UI Droppable destroy() Method

Last Updated : 20 Jan, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

jQuery Mobile is a web-based technology that is used to make responsive content for websites that can be accessed on all types of smartphones, tablets, and desktops.

In this article, we will be using the jQuery Mobile Droppable destroy() method to remove the droppable functionality completely from the widget. This method returns the element back to its pre-init state and this also does not accept any parameter.

Syntax:

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

Parameters: This method does not accept any parameter.

Return Value: This method destroys the widget.

CDN Link: Below are some jQuery Mobile scripts that will be needed for your project so add these to your project.

<link rel=”stylesheet” href=”https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css”>
<script src=”https://code.jquery.com/jquery-1.12.4.js”></script>
<script src=”https://code.jquery.com/ui/1.12.1/jquery-ui.js”></script>

Example: This example describes the uses of the jQuery Mobile Droppable destroy() method.

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
    <link rel="stylesheet" href=
    <script src=
    <script src=
  
    <style>
        .dragg {
            width: 90px;
            height: 50px;
            border: 1px solid black;
            background-color: blue;
        }
  
        .dropp {
            width: 100px;
            height: 90px;
            border: 1px solid black;
            background-color: green;
        }
    </style>
  
    <script>
        $(function () {
            $('.dragg').draggable({ revert: true });
            $('.dropp').droppable({
                hoverClass: 'active',
                drop: function (e, ui) {
                    $(this).html(ui.draggable.remove().html());
                    $(this).droppable('destroy');
                    $(this)
                        .find("p")
                        .html("Destroy Method Worked");
                }
            });
        });
    </script>
</head>
  
<body>
    <center>
        <h1 style="color:green;">
          GeeksforGeeks
        </h1>
        <h3>jQuery UI Droppable destroy() method</h3>
        <div class="dragg">
            <p>Drag</p>
  
        </div>
        <br><br>
        <div class="dropp">Drop</div>
    </center>
</body>
  
</html>


Output:

jQuery UI Droppable destroy() Method

Reference: https://api.jqueryui.com/droppable/#method-destroy



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads