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

346
Views
Chrome Extension: PopUp Image change on click

I'm very new at chrome extensions, and navigating it is a lot of self-teaching. I was hoping someone could help with this simple issue I have!

I want to have a very small popup, that displays a closed book upon clicking the extension icon. Once clicked, I want it to switch to an open book, indicating it is "active". I currently have a manifest.json file, default popup file with a css file for styling and js file as well, and I have a background page in js.

I am not sure how to switch the book image inside the popup.

(image linked on text)

the popup window is extremely tiny, which I want it to be. Just wanted to swap those pictures to indicate active mode, and also learn how to send the "active" signal to background script to perform the task I want

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you are able to just change something like the src attribute it may be the easiest method. If you need to have two different elements then you may want to show/hide them using the style attribute and put the onclick on a parent div of the two children.

<img src="/pathToOpenBook" onclick="toggleBookOpen" alt="imageDesc" />

function toggleBookOpen(pointerEvent){
    const openBook = "/pathToOpenBook";
    const closedBook = "/pathToClosedBook";
    const element = pointerEvent.target;
    const src = element.getAttribute('src');
    const isOpen = src.toLowerCase().includes('open');
    const updateValue = isOpen ? closedBook : openBook;
    element.setAttribute('src', updateValue);
}
about 4 years ago · Juan Pablo Isaza Report
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!