Jquery – Clone a div and then clone again from the child

Tags: , , , ,
Posted in dotnet, vb, vb.net | 6 Comments »

I have the following simple code, where I double click a div (with class container) and it’s simply clones itself inside another div (with id containment-wrapper):

html

<span class="container">div one</span>

<div id="containment-wrapper">
</div>

Jquery

$(".container").dblclick(function() {

        $(this).clone().appendTo('#containment-wrapper');
});

When I double click the original div, it clones itself and puts a div inside the containment-wrapper but when I double click a cloned div, it doesn’t do anything even though it has class=container, why is this happening? I tried many different ways to clone it but nothing worked.

Similar:

  1. How do I select a child element by ID with jQuery? I’m having trouble selecting the text inside a span element that resides in another container. The situation I’m trying to solve is on the page...
  2. Help fixing Clone Stamp Tool Issue Hello.  I am trying to track down a problem 3 of my users are having with CS4 version of photoshop.   When they are trying...
  3. What is the best Mercurial clone / repository strategy? There can be: 1) just clone from remote repo as needed (each new one can take 20 minutes and 500MB) 2) clone 2 local ones...
  4. Jquery .wrap and first-child Hi, I’m in a situation in which I need to use .wrap and :first-child. This is what I am doing: <script>$("a").wrap("<div class='category-wrapper'></div>");</script> <script>$("div.category-wrapper:first-child").addClass("first");</script> This should...
  5. Taking Clone() of a Stream Please help me how to take clone of an Input Stream. I want to take clone of file uploaded through file upload control. ie clone...

Tags: , , , ,

6 Responses to “Jquery – Clone a div and then clone again from the child”

  1. [...] Jquery – Clone a div and then clone again from the child | The … [...]

  2. [...] Jquery – Clone a div and then clone again from the child | The … [...]

  3. [...] Jquery – Clone a div and then clone again from the child | The … [...]

  4. [...] Jquery – Clone a div and then clone again from the child | The … [...]

Leave a Reply