var au=document.getElementsByTagName("video"); for(var i=0;i<au.length;i++){ au[i].addEventListener("playing", function(){ var this1=this; this.play(); for(var b=0;b<au.length;b++){ var this2=au[b]; if(this1!==this2){ this2.pause(); } } }); }