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

197
Vistas
Enable and disable. One then the other

One button shows the user local time when clicked. Then I have another button that stops the clock. I am trying to disable "show local time" when the button "stop time" is clicked.

<button id="start" onclick="showTime()" >Show Local showTime</button> <button id="stop" onclick="myStop()">Stop Time</button>

This is my code in HTML

I've tried this for my javascript document.getElementById(start).disabled = true; document.getElementById(stop).removeAttribute('disabled')

Tried this

function showTime() {
    document.getElementById("start").disabled = true;
  }
  
  function myStop() {
    document.getElementById("stop").disabled = false;
  }

None of these have works for disabling the other button. They both are being allowed to be clicked.

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

0

As far as I got the question, you need to disable one button when you click the other button. I will post an answer that will do the work.

function showTime() {
    document.getElementById("stop").disabled = !document.getElementById("stop").disabled;
}
  
function myStop() {
    document.getElementById("start").disabled = !document.getElementById("start").disabled;

}

When you click the show local time button,

  • it will disable the stop time if stop time is enabled
  • it will enable the stop time if stop time is disabled

When you click the stop time button,

  • it will disable the show local time if show local time is enabled
  • it will enable the show local time if show local time is disabled
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