Ver Mensaje Individual
  #6 (permalink)  
Antiguo 26/07/2011, 06:33
Dany_s
 
Fecha de Ingreso: diciembre-2009
Ubicación: Misiones
Mensajes: 867
Antigüedad: 14 años, 5 meses
Puntos: 65
Respuesta: jQuery evitar duplicados en el drag y drop

Código HTML:
Ver original
  1.     <head>
  2.         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  3.         <title>JSP Page</title>
  4.         <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
  5.         <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"></script>
  6.     </head>
  7.     <script>
  8.     $( function(){
  9.         $( "#uno li" ).draggable({helper:'clone'});
  10.  
  11.         $( "#dos" ).droppable({
  12.             accept: "#uno li",
  13.             drop: function( event, ui ){
  14.                 $("#dos").append( ui.draggable );
  15.             }
  16.         });
  17.     });
  18.     </script>
  19.     <style>
  20.         ul{min-height:50px; width:50px; background:#ccc}
  21.     </style>
  22.     <body>
  23.  
  24.     <ul id="uno">
  25.         <li>Uno</li>
  26.         <li>Dos</li>
  27.         <li>Tres</li>
  28.     </ul>
  29.  
  30.     <ul id="dos">
  31.  
  32.     </ul>
  33.  
  34.     </body>
  35. </html>