javascript - Customize Button mute of video -
i have code. works perfect.
<button id="mutebtn2">mute</button></li> <script> mutebtn2 = document.getelementbyid("mutebtn2"); mutebtn2.addeventlistener("click",vidmute2,false); function vidmute2(){   if(idle_video.muted){      idle_video.muted = false;      mutebtn2.innerhtml = "mute";   } else {      idle_video.muted = true;      mutebtn2.innerhtml = "unmute";   } } </script>   this code mute video, works fine.
the question is, want replace button image on/off. tried code seems me error. i'm appreciate
you can replace text inside <button id="mutebtn2">mute</button> img
<button id="mutebtn2"><img src="link-to-image" /></button>   and within vidmute2() function, instead of replacing innerhtml text replace img html 
function vidmute2(){   if(idle_video.muted){      idle_video.muted = false;      mutebtn2.innerhtml = "<img src='link-to-image' />";   } else {      idle_video.muted = true;      mutebtn2.innerhtml = "<img src='link-to-image' />";   } }      
Comments
Post a Comment