Reputation: 79
everyone I am a begginer at this so please have a patient for me. I'got this on my mind, I am traing to change the color of the whole text in p selectors, using LocalStorage, but it dosen't working.
To be clear I have found this code and this is a basic form : How to keep font size always 150% after page refresh or open page again?
And this is mine :
if (localStorage.fontColor)
{
$('p').css('fontColor', localStorage.fontColor);
}
$("#m").click(function () {
$("p").css("color", "red");
localStorage.fontColor = 'red';
});
$("#n").click(function () {
$("p").css("color", "black");
localStorage.fontColor = 'black';
});
Upvotes: 0
Views: 311
Reputation: 26281
This line:
$('p').css('fontColor', localStorage.fontColor);
Should be:
$('p').css('color', localStorage.fontColor);
Upvotes: 2