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

335
Vistas
How can I make a dropdown selection trigger an overlay image?

I have two dropdown menus. The picture that's displayed changes based on the dropdown selection.

I want to make it so that when a User chooses a color and then an overlay, the overlay image displays on top of the color image rather than replacing it.

I'm new to javascript and not sure where to begin to solve this, so any insight at all really helps.

var changeColorImage = function() {
  document.getElementById('image').src = this.options[this.selectedIndex].value + "_Image.png"
}

var colorList = document.getElementById('ColorList');
colorList.addEventListener('change', changeColorImage, false);


var changeOverlayImage = function() {
  document.getElementById('image').src = this.options[this.selectedIndex].value + "_Image.png"
}

var overlayList = document.getElementById('OverlayList');
overlayList.addEventListener('change', changeOverlayImage, false);
img {
  margin: 50px;
  width: 100px;
}
<select id="ColorList">
  <option value="none">None</option>
  <option value="blue">Blue</option>
  <option value="red">Red</option>
  <option value="green">Green</option>
</select>

<select id="OverlayList">
  <option value="overlay_1">Overlay 1</option>
  <option value="overlay_2">Overlay 2</option>
  <option value="overlay_3">Overlay 3</option>
</select>

<img id="image" src="none_Image.png" />

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