Hi guys,
I have found a great tutorial on how to show and hide a certain div on a page. I got the code working fine, but I would like to extend is to that the show/hide is remembered on page loads. I've looked for a solution jQuery cookie was the answer.. if I'd knew how to write the actual code that is.. Here's the current snippet:
<script type="text/javascript">
jQuery(document).ready(function() {
// hides the group_desciption as soon as the DOM is ready
// (a little sooner than page load)
jQuery('#group_desciption').hide();
// shows the group_desciption on clicking the noted link
jQuery('a#slick-show').click(function() {
jQuery('#group_desciption').show('slow');
return false;
});
// hides the group_desciption on clicking the noted link
jQuery('a#slick-hide').click(function() {
jQuery('#group_desciption').hide('fast');
return false;
});
// toggles the group_desciption on clicking the noted link
jQuery('a#slick-toggle').click(function() {
jQuery('#group_desciption').toggle(400);
return false;
});
});</script>
Any idea how I can add the cookies to remember the selection from the user? A code sample would be great since I'm still trying to grasp jQuery/Javascript in general :)
Thanks in advance :)