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

101
Views
Set JavaScript variable to match another variable on click with memory

I'm looking to allow users to change the images on a site, and save the new images in local storage.

There are 5 divs with background images (can all be declared in variables). When each is clicked, it brings up a container that includes 10 image options (more variables). When the user clicks an option, the container closes and some jQuery sets the background image of the div that was clicked to the image that was clicked.

Having some trouble wrapping my head around the variables - the container is global, so the script needs to remember which div was clicked and only change the background image of that div. And to save it in local storage, the variable for the background image needs to be saved as the image URL selected. Is there some dynamic variable or array work to be done here? Appreciate the help!

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!