I am creating a dynamic div using Jquery and I am trying to cache it so that, I will get it back after the page refresh, please help on how to achieve this,
pasting the code below
<script src="jquery-1.3.2.js" type="text/javascript"></script>
<script src="jQuery.jCache.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$.jCache.maxSize = 20;
function createDiv() {
var divTemp = "<div><label>This is a Label</Label></div>";
alert(divTemp);
$(divTemp).appendTo("#divDisplay");
$.jCache.setItem("myKey", divTemp);
}
$(document).ready(function() {
if ($.jCache.hasItem("myKey")) {
var cacheDiv = $.jCache.getItem("myKey");
var cacheDiv = cacheDiv + "<a>anchor Tag</a>";
$(cacheDiv).appendTo("#divDisplay");
}
});
</script>
I am trying to draw a div in the page using button click, after the click div is drawn in the page, when its refreshed using an F5 click, the div disappears, is there any way to retain the div contents using caching mechanisms?
this is been a showstopper for my whole functionality!
Thanks in advance, Shajo