I'm currently building a chrome extension using javascript. I need to run a script to get the input element of the active tab, so in my background/index.js file, I tried to do a document.querySelector("#subBtn") but I received:
Uncaught ReferenceError: document is not defined Context background.js Stack Trace background.js:1 (anonymous function)
const subBtn = document.querySelector("#subBtn");
const resetBtn = document.querySelector('.reset');
const intputPart = document.querySelector("#form");
window.resetBtn.addEventListener('click', () => {
intputPart.style.display = "block";
location.reload();
})
.....