seeraig
asked on
Back Button Causing Issues With Hidden Divs
On the page I have 2 hidden divs (display: none;) on page load. They are revealed with a jquery click function and then the user submits a form. If the browser back button is pressed, the divs are hidden again. I would like to have the divs shown on back button press, but I have no idea how to do this.
ScreenCast.flv
ScreenCast.flv
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank Julian. I'll try and test this out later today and let you know if I can get it working.
ASKER
Hi Julian,
This seems like I got this working, need to test a little more. What's the best way to delete the cookie, like after checkout?
This seems like I got this working, need to test a little more. What's the best way to delete the cookie, like after checkout?
Just set the cookie to a blank value with an expiry date in the past (-1, 0, 1970-01-01 etc)
You can read more on these links
https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie#notes
http://www.w3schools.com/js/js_cookies.asp
I would recommend reading both of those pages through to get a complete understanding of how cookies work.
You can read more on these links
https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie#notes
http://www.w3schools.com/js/js_cookies.asp
I would recommend reading both of those pages through to get a complete understanding of how cookies work.
CSS
Open in new window
HTMLOpen in new window
jQueryOpen in new window
Updated sample here