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

259
Vistas
Click two elements at the same time by clicking one button with javascript

Is it possible to click one button and simultaneously click another element. Like I click a button to show an image and simultaneously let something else appear which would also appear when clicking on it

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

It's totally possible. You have to get the click event of the element, and you can do whatever you want.

Example:

  <button id="button">I am a button</button>
  <div id="anotherElement"></div>
  <script>
    const button = document.getElementById('button');
    const anotherElement = document.getElementById('anotherElement');
    button.addEventListener('click', () => {
      // do whatever you want here
      anotherElement.click();
    });
  </script>
about 4 years ago · Juan Pablo Isaza Denunciar

0

As our friend Said says, is possible, just I think if would be better if you name classes instead of ID because is a better practice

   <button class="button">Do something here</button>
   <button class="button">And here</button>
   <script>
     const button = document.getElementsByClassName ('button');
     button.addEventListener('click', () => {
     // do whatever you want here
        });
   </script>
about 4 years ago · Juan Pablo Isaza Denunciar
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