Hi All,
I’m sure it’s something simple I’m just missing, but I’m trying to figure out how to apply an animate.css class to a button using jQuery every time the button is clicked. With the code below, it applies it the first time it is clicked, and then the animation does not happen again on subsequent clicks. I thought it would be as simple as adding the class with jQuery then immediately removing it within the playClip function but that doesn’t seem to be working. Below is my code.
let playClip = (clicked_id) => {
let clip = document.getElementById(clips[clicked_id]);
clip.play();
document.getElementById("display").innerHTML = clicked_id.toUpperCase();
$(`#${clicked_id}`).removeClass("animate__animated animate__pulse");
$(`#${clicked_id}`).addClass("animate__animated animate__pulse");
};
Here is the entire code including HMTL, CSS and JS.
Thanks in advance for any assistance you can give. All tests are passing at this point, I’m just trying to add some extras now and make it better.