Why doesn't this work?
localStorage.fontSize
contains the proper value, but the first document.body.style.fontSize = localStorage.fontSize + "pt";
doesn't update the style.
<script type="text/javascript">
if(!localStorage.fontSize){
localStorage.fontSize = Number(11);
}
else{
document.body.style.fontSize = localStorage.fontSize + "pt"; /* This row doesnt run */
}
function resetFont(){
localStorage.fontSize = Number(11);
document.body.style.fontSize = "11pt";
}
function enlargeFont(){
localStorage.fontSize++;
document.body.style.fontSize = localStorage.fontSize + "pt"; /* But this does if called */
}
</script>
No jQuery snippets please.