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

java - How to specify maven bin in eclipse maven plugin? -

Error while updating a record in APEX screen -

c++ - In an add-in in Excel, written in C(++), how does one get the name of the function which called into the addin? -