staram się napisać funkcjonalność w której jeden div jest kontenerem na którym upuszczam div (Component) które znajdują się poza kontenerem. Samo przeciąganie i upuszczanie nie stanowi problemu tylko co w przypadku gdy muszę zdefiniować dużo divów Component? Drugie pytanie, w jaki sposób po upuszczeniu diva Component na div kontener mogę wyświetlić np. alertem tekst który znajduje się w divie upuszczanym?
<html> <head> <style type="text/css"> #GridDiv { width: 200px; height: 200px; background-color: #F00; } #Component1 { width: 200px; height: 25px; background-color: #0FF; } #Component2 { width: 200px; height: 25px; background-color: green; } </style> <script type='text/javascript'>//<![CDATA[ $(function(){ $( "#Component1" ).draggable(); $( "#Component2" ).draggable(); $( "#GridDiv" ).droppable({ accept: "#Component1, #Component2", drop: function( event, ui ) { var droppable = $(this); var draggable = ui.draggable; // Move draggable into droppable draggable.appendTo(droppable); draggable.css({top: '0px', left: '0px'}); } }); });//]]> </script> </head> <body> </body> </html>