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

273
Vistas
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 Respuestas
Responde la pregunta

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