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

203
Vistas
After adding pushState, back button gives unexpected results, loads content partially

I have a multi-step form with "next" and "previous" buttons that dynamically change the content. I want to use pushState so that the customer can also click the "previous" and "forward" buttons on his browser and mimic the same behavior.

This is where I got so far: when the user presses the browser back button, the page does go back as expected, but it's missing content, and also the previous form fields are unfilled or dysfunctional. It's very hard for me to understand what exactly is going on...

Here is my code:

$(document).on('click', '.next-button', function () {
  window.history.pushState($(".one-shot-form").html(), '', "");
});

$(window).on("popstate", e => {
    $(".one-shot-form").html(e.originalEvent.state);
});

Note: ".one-shot-form" is the name of the form's container, for which I want to dynamically change the content.

Any help would be dearly appreciated!

about 4 years ago · Juan Pablo Isaza
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