Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
Add event listener to chrome extension button

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!!!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!