admin管理员组

文章数量:1208155

console.log(alert('WORKING'));

var videoElement = document.getElementsByClassName('video-stream')[0];

videoElement.addEventListener(
  'pause',
  function(){ 
  alert('paused!');
  }
);

I know python but am trying to learn JavaScript. Im practicing by working on a Chrome extension but I'm already stuck.

The first line works I get popup when I open youtube in my chrome browser. But the next line does not. When I pause the video I do not get a popup. But if I copy the same line it into the console in chrome it does work. I will get a popup when I pause.

本文标签: javascriptWhy does my line of code to detect pausing video not workStack Overflow