Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda