I have an image tag with the "kiwi" class, and another class that makes it spin. I want to toggle this second class (called 'elem') when clicking on the play button of my music player.
Here is the image tag with the class:
<img src="./images/kiwi.png" class="kiwi" aria-hidden="true" />
This is what I want to achieve:
<img src="./images/kiwi.png" class="kiwi **elem**" aria-hidden="true" />
And here is the play button which should add the 'elem' class to the image tag once clicked:
<button onclick="justplay()" id="play"><i class="fa fa-play" aria-hidden="true"></i></button>
Below is the script for the play button:
let play = document.querySelector("#play");
function playsong() {
track.play();
Playing_song = true;
play.innerHTML = '<i class="fa fa-pause" aria-hidden="true"></i>';
}
I want the round image to spin when the play button is pressed
I tried searching online for a solution using classList but couldn't figure it out.