Auto-play an HTML5 video on Dom Load using jQuery

后端 未结 3 655
野的像风
野的像风 2021-01-18 07:38

I\'m trying to play a video as soon as the dom has loaded using jQuery. This is my code:

HTML

3条回答
  •  爱一瞬间的悲伤
    2021-01-18 07:41

    I know is not jQuery but in standard javascript with html5 you can use:

    var video = document.getElementById("target_video");
    video.autoplay = true;
    video.load(); 
    

提交回复
热议问题