Really need your help here. I would like to have a timer for content in localStorage.
For example I have got a dynamically updated DIV
<div id="news"><p>test</p></div>
And managed to add it as html block to localStorage by using this code:
$(function() {
localStorage["homeNews"] = JSON.stringify($("#news").html());
});
$(function() {
if (localStorage["homeNews"] != null) {
var contentsOfNews = JSON.parse(localStorage["homeNews"]);
$("#news").html(contentsOfNews);
}
});
There is an example but it doesn't seem work for some reason: http://jsfiddle.net/Rn4NC/4/