JQuery: add clone to container

Are there other ways to add a cloned item to a container than:

$(".product").draggable({
    helper: 'clone'
});

$("#container").append(ui.draggable.clone());

      

append simply puts an item after the last item in the #container. I want to decide where the position should be.

+1


a source to share


1 answer


You can use before()

or after()

to insert an element at a specific position.



$(".product").draggable({
    helper: 'clone'
});

$("#container #target").after(ui.draggable.clone());

      

+2


a source







All Articles