Ron Ron - 2 months ago 8
jQuery Question

clone all element and content inside div and display it into another div

Get all elements inside a particular div and display the the same to other div.
the content inside is dynamic .
I want to clone all the elements inside
ie

<div id="div_preview">
<br>
2 php Developer ?<br>
<input type="checkbox" name="chk_0" value="a">
a
<input type="checkbox" name="chk_1" value="b">
b
<input type="checkbox" name="chk_2" value="c">
c
</div>

from <div id="div_preview"> and display it to <div id='other_div'></div>


so that o/p

<br>
2 php Developer ?<br>
<input type="checkbox" name="chk_0" value="a">
a
<input type="checkbox" name="chk_1" value="b">
b
<input type="checkbox" name="chk_2" value="c">
c

Answer
document.getElementById('other_div').innerHTML = document.getElementById('div_preview').innerHTML;