1
I can’t do that after clicking the button, change the video I wanted the video to change at the top, but appears 2 after clicking the button...
function setvideo(src) {
document.getElementById('div_video').innerHTML = '<video autoplay controls id="video_ctrl" style="height: 100px; width: 100px;"><source src="'+src+'" type="video/mp4"></video>';
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<video autoplay id="video_ctrl" style="height: 100px; width: 100px;">
<source src="video.mp4" type="video/mp4">
</video>
<button onClick="setvideo('video.mp4');">Video1</button>
<button onClick="setvideo('video2.mp4');">Video2</button>
<div id="div_video"> </div>
Thank you very much :D
– Yuri Rodrigues