I'm looking to clone a div
element after it when a button
is clicked. I've come across solutions in vanilla JavaScript, but I really need a solution using jQuery as I struggle with it. Can anyone lend a hand?
This is my current setup:
<div class="example-1">
<div class="example-2">
<p>Example one</p>
<p>Example two</p>
<button class="btn-copy">Copy</button>
</div>
</div>
This is what I aim for (after the click):
<div class="example-1">
<div class="example-2">
<p>Example one</p>
<p>Example two</p>
<button class="btn-copy">Copy</button>
</div>
<div class="example-2">
<p>Example one</p>
<p>Example two</p>
<button class="btn-copy">Copy</button>
</div>
</div>