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

95
Views
Increment Button at Javascript using html and css. I am bit confused

Neither in the IDE when I preview does the button click nor in the various browsers I used. (Mozilla, Chrome)

I want the button to click but I can not do it although the IDE does not get an error. Take the following piece of code:

function increment() {
  console.log("The button was clicked")
}
increment()
html,
body {
  margin: 0;
  padding: 0;
}

button {
  border: none;
  padding-top: 10px;
  padding-bottom: 10px;
  color: white;
  font-weight: bold;
  width: 200px;
  margin-bottom: 5px;
  border-radius: 5px;
}

#increment-btn {
  background: darkred
}
<!DOCTYPE html>
<html lang="el">

<head>
  <title>Page Count</title>
  <link rel="stylesheet" href="index.css">
</head>

<body>
  <h1>People enter:</h1>
  <h2 id="count">100</h2>
  <button id="increment-btn" onclick="increment()">INCREMENT</button>

  <script src="index.js"></script>
</body>

</html>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

in your Javascript file don't call the function again. as you are already calling it on button,

i mean on button you have added " onclick " handler it should work just fine. just remove last line in Javascript file

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!