Skip to content
Related Articles

Related Articles

jQWidgets jqxDragDrop dropTargetLeave Event

View Discussion
Improve Article
Save Article
Like Article
  • Last Updated : 28 Nov, 2021

jQWidgets is a JavaScript framework for making web-based applications for PC and mobile devices. It is a very powerful, optimized, platform-independent, and widely supported framework. The jqxDragDrop is used to represent a jQuery drag and drop widget that is used to make any DOM element draggable. It can be used in combination with many widgets like jqxTree, jqxGrid, jqxListBox and etc.

The dropTargetLeave event is triggered while the item leaves its drop target.

Syntax:

$('#jqxDragDrop').on('dropTargetLeave', function () {
 // Code here.
});

Linked Files: Download jQWidgets from the link. In the HTML file, locate the script files in the downloaded folder.

<link rel=”stylesheet” href=”jqwidgets/styles/jqx.base.css” type=”text/css” />
<script type=”text/javascript” src=”scripts/jquery-1.11.1.min.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqx-all.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxcore.js”></script>
<script type=”text/javascript” src=”jqwidgets/jqxdragdrop.js”></script>

Example: The below example illustrates the jqxDragDrop dropTargetLeave event in jQWidgets.

HTML




<!DOCTYPE html>
<html lang="en">
  
<head>
    <link rel="stylesheet" 
          href="jqwidgets/styles/jqx.base.css"
          type="text/css" />
    <script type="text/javascript"
            src="scripts/jquery-1.11.1.min.js">
    </script>
    <script type="text/javascript"
            src="jqwidgets/jqx-all.js">
    </script>
    <script type="text/javascript"
            src="jqwidgets/jqxcore.js">
    </script>
    <script type="text/javascript"
            src="jqwidgets/jqxdragdrop.js">
    </script>
</head>
  
<body class='default'>
    <center>
        <h1 style="color:green;">
            GeeksforGeeks
        </h1>
  
        <h3>jQWidgets jqxDragDrop dropTargetLeave event</h3>
  
        <div id="dragID" 
             style="width:120px;
                    height:120px;
                    border: 1px solid black;
                    background-color:green;">
  
            <div style="display:flex;
                        justify-content:center;
                        align-items:center;
                        height:100%;">
                Drag me
            </div>
        </div>
  
        <div id="dropID"  
             class="dropTarget" 
             style="width:150px; 
                    height:150px; 
                    background:blue; 
                    margin-top:50px;
                    border:1px solid black;">
            <div style="display:flex;
                        justify-content:center;
                        align-items:center;
                        height:100%;">
                Drop here
            </div>
        </div>
    </center>
  
    <script type="text/javascript">
        $(document).ready(function() {
            $("#dragID").jqxDragDrop({
                dropTarget: "#dropID"
            });
  
            $('#dragID').on('dropTargetLeave', 
            function (event) {
                $("#dropID").css({background: "red"});
            });
        });
    </script>
</body>
</html>

Output:

Reference: https://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxdragdrop/jquery-dragdrop-api.htm?search=


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!