0

How to make a toggle play/pause audio in only one button using the .pause and .paused trick?

I don't know how these .pause and .paused work at all, I don't what is the play and what is the pause on the two of them. So I wanna see a toggle play/pause in only one button to see how they really work.

15th Feb 2022, 9:48 AM
trash
3 Answers
15th Feb 2022, 11:24 AM
Kashyap Kumar
Kashyap Kumar - avatar
0
Kashyap Kumar ā­• Thank you bro! But last question, what does the .classList.toggle("paused") do? I removed the class="" and that and it still worked??
15th Feb 2022, 3:50 PM
trash
0
That line remove the class if already exists and add if doesn't exist. Generally used for styling.
19th Feb 2022, 8:40 AM
Kashyap Kumar
Kashyap Kumar - avatar