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

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

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