Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

205
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!