This is my first go at localStorage and its not going. I have the jQuery code below to increase the page font size if an element is selected. Problem is when you go to a new page, it reverts back. I've tried some different variations but I am stuck. Any help is appreciated.
$textSize1.click(function() {
$( "body" ).css("font-size", "10px");
localStorage.setItem("$textSize1", $textSize1);
});
$textSize2.click(function() {
$( "body" ).css("font-size", "20px");
localStorage.setItem("$textSize2", $textSize2);
});
$textSize3.click(function() {
$( "body" ).css("font-size", "30px");
localStorage.setItem("$textSize3", $textSize3);
});
localStorage.getItem("$textSize1");
$textSize1.click(function() {
$( "body" ).css("font-size", "10px");
localStorage.setItem("$textSize1", $textSize1);
});
$textSize2.click(function() {
$( "body" ).css("font-size", "20px");
localStorage.setItem("$textSize2", $textSize2);
});
$textSize3.click(function() {
$( "body" ).css("font-size", "30px");
localStorage.setItem("$textSize3", $textSize3);
});
localStorage.getItem("$textSize1");
storeValue? What do you hope will be in that variable by the time you retrieve it?localStoragebefore you set it? You need to see what's in there before you can decide whether to overwrite it or not!