Open In App

jQuery UI Droppable disable() Method

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 disable() method to disable the droppable and this also does not accept any parameter.

Syntax:

$(“.selector”).droppable( “disable” );

Parameters: This method does not accept any parameters.

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 disable() method.

HTML




<!DOCTYPE html>
<html lang = "en">
<head>
  <meta charset = "utf-8">
     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>
    
  <style>
     .dragg { 
        width: 90px; height: 50px;
        border: 1px solid black;  
        background-color:blue;
     }
     .dropp2, .dropp3 { 
        width: 200px; height: 50px;
        border: 1px solid black; 
        float : center;
        background-color:green;
     }
  </style>
    
  <script>
     $(function() {
        $( ".dragg" ).draggable();
        $( ".dropp2" ).droppable({
           drop: function( event, ui ) {
              $( this )
              .find( "p" )
              .html( "Dropped!" );
           }
        });
          
        $( ".dropp3" ).droppable("disable");
              
        $( ".dropp3" ).droppable({
           drop: function( event, ui ) {
              $( this )
              .find( "p" )
              .html( "Dropped!" );
           }
        });
     });
  </script>
</head>
  
<body>
    <center>
        <h1 style = "color:green;">GeeksforGeeks</h1>
      
        <h3>jQuery UI Droppable disable() method</h3>
          
        <div class = "dragg">
            <p>Drag</p>
        </div>
        <br><br>
        <div class = "dropp2">
            <p>Drop here</p>
        </div>
        <br><br>
        <div class = "dropp3">
            <p>Disable - Can't Drop Here</p>
        </div>
    </center>
</body>
  
</html>


Output:

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



Last Updated : 14 Jan, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads