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

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

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 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