I am new to chrome extension development, and I understand that this question is simple but I couldn't find it online. I was wondering how I could add a listener and hide or show a certain div on chrome extension button press. This is my current code in manifest.js for background where I am trying to connect chrome extension click (which is not working) to content.js.
"background": {
"service_worker": "background.js"
},
and this is my background.js file...
chrome.browserAction.onClicked.addListener(function (tab) {
chrome.tabs.create({ 'url': "http://www.youtube.com/watch?v=oHg5SJYRHA0" });
//above code used for testing but never gets executed for some reason when I try to click chrome extension button
});
Thank you in advance for your answers!!!