Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

102
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda