Article

Add class

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

If we want to copy the styles of the gray pop up div to the wannabe div we should instead write: https://raw.githubusercontent.com/finsweet/jqueryCourse/main/copypaste/ex2.js?actionable=true We use the jquery function removeClass() to delete styles of the wannabe div and use addClass() to add the gray div class.

<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.