I have a form which is hidden using slideToggle(). What I need to do is allow the user to view the form once clicking the ‘show form’ link, fill out the form and hit submit. Then, if there are any errors allow the page to refresh with the div still showing.
In other words how do I prevent slideToggle() from resetting on the page refresh. As otherwise the user has to then show the form again in order to see errors. I’m just using a basic PHP_SELF with some code on this rather than AJAX as I want to keep it dead simple.
Here is my current JS:
$('a#booknow').click(function() {
$('#formcontain').slideToggle('slow', function() {
$(this).toggleClass('houdini');
});
return false;
});
Thanks
I would use a cookie, and additionally I’d use a plugin (as writing client-side cookie management code makes my head hurt).
Then on page load: