1

I am creating a Chrome Extension which pauses the video on YouTube on load. At the moment when you click a video on YouTube it will automatically play, however I would like to pause it instead. I have found the element for the play button and at the moment I have made script, however it isn't working. Is it possible to automatically click something using jQuery?

Script:

$(document).on("DOMSubtreeModified", function() {
   $(".ytp-button-play").trigger("click");
});

Also, the element for the video itself is #movie_player and I have tried the .load() method for that element but it isn't working either.

Here is the Inspect Element: enter image description here

Any help will be appreciated :) Thanks

Ryan Hawdon
  • 389
  • 2
  • 6
  • 15
  • possible duplicate of [JQuery code on Chrome Extension doesnt work](http://stackoverflow.com/questions/28398550/jquery-code-on-chrome-extension-doesnt-work) – Xan Feb 18 '15 at 11:49
  • Or alternatively, this question: http://stackoverflow.com/q/17152932/934239 – Xan Feb 18 '15 at 11:49

0 Answers0