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

164
Vistas
Button that functions conditionally depending on whether or not another button is clicked

I'm making a program with 4 players.

Each player having a main button to trigger a main function and 3 more buttons, each blocking one of the 3 remaining players from performing the main function while triggering the same main function for the player pushing the button

When the blocked player pushes their main button it triggers a different function than the main one.

I have been able to make the main button and its functionality but not the effects of the block button.

Currently I'm putting this in my external js script for the blocked function:

if (document.getElementById("kelly-block-john").clicked == true){
  document.getElementById("john-button").onclick = "johnBlocked()";
}

Does anybody have any idea on how to make the effects of the block buttons work?

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

0

Use Event Listener to check if the button is clicked and also to run a function when it is clicked. Find out the details and syntax here: https://www.w3schools.com/js/js_htmldom_eventlistener.asp

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