Bernie Carpio
Bernie Carpio

Reputation: 321

Control JQuery Multi-Step Form By Browser Back Button

I'm wondering how did they control the multi-step form using browser back button, Veterans United and Canada Drives does it. I have a multi-step form controled by Jquery what I need to do is to copy their style that instead of changing the page when you click the browser back button it will just go to previous step.

Thanks

https://www.veteransunited.com/

https://www.canadadrives.ca/

Upvotes: 1

Views: 1400

Answers (1)

yezzz
yezzz

Reputation: 3020

Looks like they're using history api.

Pushstate when user clicks on the continue button. history.pushState(obj, "title", "#")

And listening for popstate event which is fired when user clicks browser back button.

Upvotes: 3

Related Questions