0
I’m saving the font size on localStorage
and recovering to set after the page is ready, I am not able to set using the value recovered in localstorage, to set the source I am using jquery, follow code
Assim não funciona
$( document ).ready(function() {
// font size
var $elemento = $(".verseTextP");
var fontSize = window.localStorage.getItem('fontSize');
alert(fontSize)
$elemento.css('font-size', fontSize);
});
Assim funciona
$( document ).ready(function() {
// font size
var $elemento = $(".verseTextP");
var fontSize = window.localStorage.getItem('fontSize');
alert(fontSize)
$elemento.css('font-size', 25);
});
The
alert
is to show that the value is saved inlocalStorage
and I can get the value right, which is the problem, because it doesn’t work if you use the value from alocaStorage.getItem
?
Perfect guy! Thank you so much.
– Miguel Silva