1

I have a quick question should be easy, but need to make it fast

I want to take with jquery one div and to put this div in another one, but the first one should be.

I have this HTML

<div class="content">Some text</div>

I want to put this content in another div

<div class="test"> content div should be here </div>

Jquery styff :

$(".content").click(function(){
                $(".test").html($(this));   
            });

But after that the original <div class="content"> disappears, but I need to leave it.

1 Answer 1

6

You'll want to clone the original div:

$(".content").click(function(){
    $(".test").append($(this).clone()); 
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.