I\'m trying to play a video as soon as the dom has loaded using jQuery. This is my code:
HTML
$('video#video').each( (i,e) => e.play() );
As Justin McDonald noted, the play()
method exists on the Video DOM Node itself, so you first have to resolve the jQuery Object to the specific Node. However, his solution will throw an error if the element with id="video"
does not exist or is not a video
Node.