jQuery UI Ticket 3275 - droppable Revision 3093706d1947 (Tue Dec 16 2008 at 17:24) - Diff Link to this snippet: https://friendpaste.com/3JACC6YaCD3XEzNAGewTCU Embed: manni perldoc borland colorful default murphy trac fruity autumn bw emacs pastie friendly Show line numbers Wrap lines 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html> <head> <title>droppable</title> <style> body { font-family: Helvetica; background: gray; color: white; font-family: monospace; font-size: 110%; } #forum { position: relative; } .cargo { position: absolute; left: 10px; width: 20px; height: 20px; background: #3366cc; } #container { position: absolute; left: 200px; width: 250px; height: 100px; background: #66cc33; } #panel { width: 500px; position: relative; top: 150px; } #setup { background: black; float: right; cursor: pointer; padding: 2px; } </style> <script src="jquery.js" type="text/javascript"></script> <!-- Tested against 1.2.6 - Rev 5685 --> <script src="jquery.ui.all.js" type="text/javascript"></script> <!-- Tested against 1.5.2 --> <script type="text/javascript"> var createDraggableAndDroppable = function () { $("#forum").append("<div class='cargo'></div>"); $(".cargo").draggable(); $("#container").droppable({ accept: ".cargo", drop: function () { $("#log").append("<br/>dropped!"); } }); }; var launch = function () { $("#setup").click(createDraggableAndDroppable); }; $(document).ready(launch); </script> </head> <body> <p> Click setup and drag the blue box onto the green box. Rinse and repeat. <br/> drop new and old blue boxes to see different numbers of invocations </p> <div id="forum"> <div id="container"></div> </div> <div id="panel"> <div id="setup">setup</div> <div id="log">Drop Invocations</div> </div> </body></html>