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

274
Visualizações
How to hide content and show it after processing button?

I want to hide my content. This page would contain a form and a button to process a picture. After I enter a value in the form and press the button my scripts would process the picture and automatically page will load. The result should be put in a DIV but this won't be visible after pressing the button and page load. The content is to be shown only after page processing and pressing the button. How can achieve this by using jQuery.?

my html

<button type="submit" class="btn btn-warning" id="submitBtn" >Submit</button>
<div id="toggle-show" class="container">
<div class="row"><img class="result-single" src="{% static "/assets/fig/figure1.png" %}">
</div>
</div>

my scripts

$(document).ready(function() {
$('#toggle-show').hide();

$("#submitBtn").click(function(){
  $("#toggle-show").show(); #show the pic
})

});

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use sessionStorage to do this.

For more information regarding sessionStorage: click here


$(document).ready(function () {

    $('#toggle-show').hide();

    $("#submitBtn").click(function () {
        sessionStorage.setItem("pic_visible", "true");

    });

    if (sessionStorage.getItem("pic_visible") == "true") {
        $("#toggle-show").show();
        // sessionStorage.setItem("pic_visible", "false");   
    }

});

You can also use sessionStorage.setItem("pic_visible", "false") inside the if statement to toggle the visibility to false when reloading the page the 2nd time!

JS fiddle (for a working example): click here

Also look into : localStorage

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