Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

192
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!