I have two HTML pages (page1.html and page2.html) each with their own JavaScript files (home-page.js and add-flashcard.js, respectively). Despite correctly linking the scripts, the JavaScript code from page2.html is somehow being executed or affecting page1.html.
in one JavaScript files my functions use “addEventListeners” and when I run a completely different page not related to the code with the functions, it says cannot read properties of null (reading ‘addEventListeners’) and it says that because the buttons for the event listeners are on a different page and i am sure that the page are not connected.
this is the only Javascript file I linked
Although I did have to import an array from that file that is running on the wrong page
Please can anyone help this is a school project
BritishGas1x is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1