Article

Clone

https://cdn.jsdelivr.net/npm/[email protected]/dist/js.cookie.min.js
Copy to clipboard

Some times we may need to duplicate some elements when a link is pressed. We can do this by: https://raw.githubusercontent.com/finsweet/jqueryCourse/main/copypaste/ex1.js?actionable=true We use the jquery function clone() to get a copy of the gray div and put it below the original one.

<script>
$(document).ready(function(){
  XT1
});
</script>
Copy to clipboard
Send to Live Demo

Live demo

<style>#duplicate{margin-bottom:0.5rem;} .pop-up{background-color:#5d6373; padding: 1rem;color:yellow;margin-bottom:0.5rem;}</style><div id="minidivpage" class="example-live"><a id="duplicate" target="_blank" href="#" class="button w-button">Duplicate</a><div id="popUp" class="pop-up">POP UP DIV</div><div id="popUp" class="popup-wannabe">POP UP WANNABE DIV</div></div>

<script>    
$(document).ready(function() {
  XT1
});
</script>
<script>
  
</script>
Copy to clipboard
Press the Run Demo button to execute the scripts above.
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Your browser is too small

Resize your browser to be at least 769px wide.