+ 7
gt{
What should I use for a button? Basically, I want to press the button to turn the music on or off, I have a Switch of Material Design, but I do not know how to do it.
}
Where's the Code?
basically add a click eventlistener which toggles
play() & pause() or stop() audio state with button click. add if else conditions for your use case.
Check below link for media events
https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Media_events
Check below link for help with DOM & events.
https://zellwk.com/blog/js-in-dom/
if you post in English you will get more answers.
https://www.sololearn.com/discuss/333866/?ref=app
0
Usando JS/Jquery y DOM