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

102
Vistas
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 Respuestas
Responde la pregunta

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