I have a HTML 5 video element inside a modal window. Now I need a check that if modal is opened and video element has autoplay then play the video. If the video does not have th
To check if autoplay is set:
var $video = $('.modal-box.opened').find('video'); if( typeof $video.attr('autoplay') === "string"){ $video.get(0).play(); }
or to check if autoplay is not set:
if( typeof $video.attr('autoplay') === "undefined"){ //Logic here }