I want to copy the data from one div to another div by using JS
.
$(".second_div").html($(".first_div").html())
It will be done but JS
code that is written in the first_div
, would not be copied in second_div
and it does not work in second_div
. How can I copy first_div
into second_div
and remove the first_div
?
ex.
<div class="first_div">
<span>text_test</span>
<span onclick="myfunction(this)">send</span>
</div>
js:
function myfunction(e){
console.log('ok')
}
<div class="second_div">
<span>text_test</span>
<span onclick="myfunction(this)">send</span> /// It does not work
</div>