Hi, I am a beginner at Java and was simply making some controls. However whenever i try and open in chrome i get an error in the console saying "Uncaught TypeError: Cannot read property 'addEventListener' of null
at HTMLDocument.initialiseWebPage (VideoScript.js:26)" pointing to this line. Thanks for your help in advanceplayButton.addEventListener ( "click", PlayPause );
document.addEventListener('DOMContentLoaded', initialiseWebPage); ///explanation function initialiseWebPage() { const myVideo = document.querySelector ( "video" ); myVideo.removeAttribute( "controls" ); const playButton = document.getElementById ("playPause"); function PlayPause() { if (myVideo.paused === true) { myVideo.play(); // playButton.innerHTML = "Pause"; } else { myVideo.pause(); playButton.innerHTML = "Play"; } } playButton.addEventListener ( "click", PlayPause ); }