Anyone is able to help us to solve why the localstorage is not functioning for the below
Try a lot of ways nothing win. The reason is very simple DON'T KNOW THE RIGHT WAY ?
BELOW IS THE STYLE APPLIED
<style>
.div1 {
background-color: #ff0;width:150px;height:150px;
}
</style>
Below is the HTML
<input type="color" id="colorit" onchange="setColor()"/>
<div class="div1">
</div>
AND FINALLY THE SCRIPT
<script>
$(".div1").localStorage.getItem('bgcolor') ;
var ClassName;
function setColor() {
//localStorage.setItem('background', $('#colorit').val());
ClassName = $('#colorit').val();
$('.div1').css('background-color', ClassName);
localStorage.setItem('bgcolor', 'ClassName');
}
function getColor() {
//localStorage.getItem('background');
$('#colorit').val(ClassName);
localStorage.getItem('bgcolor') ;
}
setColor();
</script>