Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Stay in same div when refresh page Reply To: Stay in same div when refresh page

#241168
Ilan Firsov
Participant

If it’s just plain tabs then I would use the hash (#) part of the URL. On tab change update the hash for the tab clicked, and on page load display the correct tab based on the hash. This method also allows your users to link to specific tabs so that’s a plus.

Depends a bit on how you handle it on the server end, the simple tabs solution can be perfect, or not suitable here at all.
What I might do in similar situation is post a the form to the server and then change what is returned to the client side to include only the appropriate form parts based on some logic (maybe save the step the user is currently on as a cookie or in the database, or even check what fields are filled and display the correct step based on that)