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

135
Vistas
Hide clicked button after toggle

I'm using this code to toggle the visibility of a section. When the button is clicked, the section shows.

function myFunction() {
  var x = document.getElementById("offerte-toggle");
  if (x.style.display === "block") {
    x.style.display = "none";
  } else {
    x.style.display = "block";
  }
}
<a onclick="myFunction()" id="knop-doorz" class="witte-randen">Offerte opvragen</a>

How can I hide the button after it has been clicked?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

your JS code is targetting an element with id offerte-toggle but in your html, the has an id of knop-doorz

Either edit the html id to match the JS or vice versa.

You also don't need to do the if check, just simply set x.style.display = 'none'; before the closing } tag.

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