views:

304

answers:

2
+2  Q: 

jquery clone drag

Hi all, i m having a problem in appending a tag over an area. I am tring to append the clone of #Normal_Tag1_div to #droppable after changing the id. I also want to make that clone draggable over #droppable only . How can i do that??

$('#Normal_Tag1_div').draggable({helper:'clone'});  
         $('#droppable').droppable({
           drop: function(ev,ui) {
                    clone = $(ui.draggable).clone();
                    $(clone).attr('id', 'newid'+count1)
                    $('#droppable').append(clone);
                    //$(clone).draggable();
                        //$('#droppable').droppable({});
                    var title = $(clone).attr('id');
                alert(title);
                 }
            });
+1  A: 

You can use containment option from jQuery UI Draggable. It restricts the drag to a given div.

Elzo Valugi
+2  A: 

Try this...

$(clone).draggable({ containment: 'parent' });

kayteen