Clone hidden div content into a second div

HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <div class="container"> <p class="clone-target"></p> <div class="load-content"> <button class="btn_clone">Click Me!</button> <p class="a_clone">This is simple example of clone method.</p> </div> <div class="load-content"> <button class="btn_clone">Click Me!</button> <p class="a_clone">This is simple example of clone method B.</p> </div> </div>
CSS
.a_clone{ display:block; } .load-content .a_clone{ display: none; }
JAVASCRIPT
$(document).ready(function(){ $(".btn_clone").click(function(){ $('.clone-target').empty(); $(this).parent().find('.a_clone').clone().appendTo(".clone-target"); }); });
Expand for more options Login