I need to insert div_A into div_B, but still keep div_A for reference ?
var div_A = document.createElement('div'); var newdiv = `<div class="div_B"> ${div_A.outerHTML} </div>`; $('.container').append(newdiv); div_A.append('Hello'); .container{ background-color:blue; width:200px; height:200px; } .div_B{ background-color:red; width:150px; height:150px; } .div_B div{ background-color:yellow; width:100px; height:100px; } <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="container"></div> Thank you for any suggestions