can someone fix this one for me ? it is made with jquery but can someone fix it without it ?

<script> $(document).ready(function(){ $('.content').click(function(){ $('.content').toggleClass("heart-active") $('.text').toggleClass("heart-active") $('.numb').toggleClass("heart-active") $('.heart').toggleClass("heart-active") }); }); </script>
5 Replies
vince
vince2y ago
Is this still for your take home assignment, or are you just doing it for practice?
samidev
samidevOP2y ago
practice
vince
vince2y ago
And you're not using a framework? Vanilla html, css, and js?
Jochem
Jochem2y ago
all you have to do to replace jquery with vanilla in this case is put this at the bottom of the page, strip out the $(document).ready wrapper, and replace
$('.content')
$('.content')
with
document.querySelector('.content')
document.querySelector('.content')
toggleClass(...) becomes classList.toggle(...) And .click(function) becomes .addEventHandler('click', function)
samidev
samidevOP2y ago
no @jochemm thanks mate i fixed it
Want results from more Discord servers?
Add your server