Share on Google+Share on Google+

jQuery UI Interaction : Droppable

This page discusses - jQuery UI Interaction : Droppable

jQuery UI Interaction : Droppable


jQuery UI Interaction : Droppable

Using jQuery droppable plug-in , you can  make selected elements droppable (meaning they accept being dropped on by draggables).

All callbacks receive two arguments: The original browser event and a prepared ui object, view below for a documentation of this object (if you name your second argument 'ui'):

  • ui.draggable - current draggable element, a jQuery object.
  • ui.helper - current draggable helper, a jQuery object
  • ui.position - current position of the draggable helper { top: , left: }
  • ui.offset - current absolute position of the draggable helper { top: , left: }

For options, events and method click here

Example :


<!DOCTYPE html>
<link href="
/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="">
<script src="">
<style type="text/css">
#draggable { width: 75px; height: 25px; background: silver; padding: 10px; }
#droppable { position: absolute; left: 250px; top: 0; width: 125px; height: 75px;
background: gray; color: white; padding: 10px; }
$(document).ready(function() {
drop: function() { alert('dropped'); }
<body style="font-size:62.5%;">

<div id="droppable">Drop here</div>
<div id="draggable">Drag me</div>


Output :

When you drop small box on big one , it will show a alert message :

Learn from experts! Attend jQuery Training classes.



Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: jQuery UI Interaction : Droppable  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
June 21, 2011

seems to be very useful ... thnx for the trouble u took ..