Hide div without giving Reload

Asked

Viewed 22 times

0

Good afternoon, I need to make a click Function without the browser being updated

 const show = document.querySelectorAll('.show_button')
 const selector = document.querySelector('.information')

   for (let bottom of show) {
     bottom.addEventListener("click", function(){
      selector.classList.add('hidden')
       location.reload(false)
      })
  }



       <div class="mostrar">
            <div class="ingredients">
                <h2>Modo de Preparo</h2>             
            </div>
            <div class="show_button">
                <button id="meu_botao" class='handle-div' type="button">ESCONDER</button> 
                <button id="meu_botao" class='handle-div' type="button">MOSTRAR</button>  
            </div>
        </div>

However each comes that I click to hide the DIV, it is giving re-load the page. I’m using Firefox and as back-end Node.js, I don’t know if this influence

  • Is giving Reload because of this line: location.reload(false). That is intentional?

  • I had put it on to see if it would stop Reload... But it continues the same way, with or without it

  • So I think it’s worth [Edit] the question to add more details, because currently the only cause of a possible Reload would be that line.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.