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

145
Views
How do I get functions to run depending on if a certain button is clicked in Javascript?

I'm working on trying to get different functions to run if a certain button in the HTML is clicked. When I open the site, it runs and there are no errors in the console, but nothing happens when I click one of the four buttons. Here is what I have right now:

 document.getElementById("answer-2").addEventListener("click", answers());

    function answers() {
        if (document.getElementById("answer-2").clicked == true) {
             showQuestions2();
        } else if (document.getElementById("answer-2").clicked == false) {
             timerPenalty();
        } else if (seconds <= 0) {
            endGame();
        }
    }
about 4 years ago · Juan Pablo Isaza
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!