jquery cookie for show hide script -


i working on small interface use very simple show , hide script.

    $(document).ready(function(){       $("#hide").click(function(){         $(".advanced").hide();         $(".basic").show();       });       $("#show").click(function(){         $(".advanced").show();         $(".basic").hide();       });     }); 

the purpose of hide , show element within navigation (basic , advanced view speak). question how can combine cookie plugin? preference stays saved , not jump "basic" view if change different page.

thank much, daniel

may have @ localstorage (in german, can't find in english)

here in english localstorage en

(because not people allow cockies)

you can store data

localstorage.setitem("key", "value");  localstorage.getitem("key"); 

working fiddle (a way how it)

$(document).ready(function () {      $(".advanced").css('display', localstorage.getitem('advanced'));     $(".basic").css('display', localstorage.getitem('basic'));      $("#hide").click(function () {         $(".advanced").hide();         $(".basic").show();         localstorage.setitem('advanced', 'none');         localstorage.setitem('basic', 'block');     });      $("#show").click(function () {         $(".advanced").show();         $(".basic").hide();         localstorage.setitem('advanced', 'block');         localstorage.setitem('basic', 'none');     }); }); 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -