0
How to change the autoplay attribute?
I'm using autoplay in my code, but I want the video to stop playing as soon as someone pushes a button. I've set the autoplay attribute to true in HTML, but how can I change it back to false in JavaScript? (or HTML if possible) This is my code: https://code.sololearn.com/WdwSg2Um7KD2/?ref=app It's about the link with id="music"
4 Answers
+ 14
video.removeAttribute("autoplay");
or
video.autoplay = "false"||"off";
video.setAttribute("autoplay","...");
//does any work??
+ 14
iframe.src = "https://www.youtube.com/embed/7JIdJLkJ0S4?autoplay=0";
//maybe change the 1 from the end of src to 0?
0
Nope :/
It's specified as iframe though, not sure if that matters
0
Nope, if I change it in HTML, it's changed from the beginning, but I want it only to stop after pushing the button and if I change it in JS I get errors