I'm trying to get a video element through the CLASS, (which sounds silly to me), But I'm not getting it, see my example:
<script src="jquery-3.2.1.js"></script>
<video id="Video1" class="video-stream" src="https://www.html5rocks.com/pt/tutorials/video/basics/Chrome_ImF.mp4"></video><divid="buttonbar">
<button id="play" onclick="vidplay()" >></button>
</div>
<script>
function vidplay() {
// com JS e pegando pelo ID funciona bem:
var video = document.getElementById("Video1");
// com JS e pegando pela CLASS nao vai...
//var video = document.getElementsByClassName("video-stream");
// com JQUERY NADA VAI! ..
//var video = $("#Video1");
//var video = $(".video-stream");
// um teste....
$.each( $( ".video-stream" ), function() {
console.log( " MESSAGE ====> | id = " + this.id );
});
// o erro aparece quando dou play no video...
video.play();
}
</script>
I need to get that element of < video > by his CLASS ... Can someone tell me what's wrong here?