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

201
Vistas
Display: none in html

I have this code:

   <div id="affichageRecherche"></div>
   <div class="row px-xl-9 d-flex justify-content-start" id="affichageCatalogue">(lot of code)</div>

And this script in bottom of the page:

<script>
let recherchePieceDetachees = document.getElementById('recherchePieceDetachees');
let affichageRecherche = document.getElementById('affichageRecherche');
let affichageCatalogue = document.getElementById('affichageCatalogue');

        recherchePieceDetachees.addEventListener('keyup', () => {
        if(recherchePieceDetachees.value.length > 2){

            affichageCatalogue.style.display = "none";
            fetch('../../requetes/catalogue-piece-detachee.php?recherche='+recherchePieceDetachees.value)
                .then(response => response.text())
                .then((response) => {
                    console.log(affichageCatalogue.style.display)
                    
                    affichageRecherche.innerHTML = response;
                })
                .catch(err => console.log(err));
                
        }else{
            affichageCatalogue.style.display = "block";
            affichageRecherche.innerHTML = "";
        }
    });
</script>

But when recherchePieceDetachees.value.lenght is > 2 affichageCatalogue.style.display = "none" doesn't work.

In "console display: none is write, but the block is always visible...

Console

Can somebody help me ? And sorry for my English... :) Thanks !

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

0

You have d-flex class in that element. Usually, inline style have highest priority but if a style rule contains !important, it will be applied. Bootstrap uses the following code

.d-flex{
    display: flex !important;
}

Since it have !important, it will be applied and your inline style will be ignored.

Inline styles aren't much recommended. You can simply add the class name d-none since you are using Bootstrap.

enter image description here

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