Skip to content

Instantly share code, notes, and snippets.

@kmartin
Created May 12, 2011 15:20
Show Gist options
  • Save kmartin/968721 to your computer and use it in GitHub Desktop.
Save kmartin/968721 to your computer and use it in GitHub Desktop.
Jquery UI Draggable/Droppable Delete Problem
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<script src="/js/jquery-1.5.1.min.js" type="text/javascript">
</script>
<script src="/js/jquery-ui-1.8.12.custom.js" type=
"text/javascript">
</script>
<style type="text/css">
#draggable { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px;}
#droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px;}
</style>
<title></title>
</head>
<body>
<script type="text/javascript">
jQuery(document).ready(function () {
$("#draggable").draggable();
$("#droppable").droppable(
{drop: function (event, ui) {
var draggable, droppable;
draggable = $(ui.draggable);
droppable = $(this).remove();
$("#container").remove();}});})
</script>
<div id="container">
<div id="draggable">
<p>drag me</p>
</div>
<div id="droppable">
<p>drop here</p>
</div>
</div>
</body>
</html>
@kmartin
Copy link
Author

kmartin commented May 12, 2011

Results in:

Uncaught TypeError: Cannot read property 'options' of undefined
$.ui.plugin.add.stopjquery-ui-1.8.12.custom.js:1340
$.extend.plugin.calljquery-ui-1.8.12.custom.js:260
$.widget._triggerjquery-ui-1.8.12.custom.js:1171
$.widget._mouseStopjquery-ui-1.8.12.custom.js:933
$.widget._mouseUpjquery-ui-1.8.12.custom.js:701
$.widget._mouseDown._mouseUpDelegatejquery-ui-1.8.12.custom.js:658
d.event.handlejquery-1.5.1.min.js:16
d.event.add.m.k.handle.mjquery-1.5.1.min.js:16

@usmanajmal
Copy link

I can see same error while using 'droppable'. Any thoughts regarding this?

JQuery UI Version: 1.10.3 2013-05-03
JQuery Version : 1.7.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment