, HTML.
$("#two").append($("#one").html());
:
<div id="one">
I want to put this div into div 2 without div one disappearing. Keep both divs visible at the same time.
</div>
<div id="two">
I want div one content to show here and keep both divs visible. I want to put this div into div 2 without div one disappearing. Keep both divs visible at the same time.
</div>
Or, as the other answers indicate, you can use clone(), but be careful, as this will make 2 elements with an identifier oneand that is the problem.
$("#two").append($("#one").clone());
Outputs:
<div id="one">
I want to put this div into div 2 without div one disappearing. Keep both divs visible at the same time.
</div>
<div id="two">
I want div one content to show here and keep both divs visible.
<div id="one">
I want to put this div into div 2 without div one disappearing. Keep both divs visible at the same time.
</div>
</div>
Please note that there are 2 elements one, you will need to change the ID of one of them.
$('#one', '#two').attr('id', 'three');
source
share