JQuery Click Event
JQuery Click Event
HTML
<button id="notif">hide count</button>
<button id="sessionclr">show count</button>
<div id="count">
Display count is 100
</div>
<br>
<div>
Hide count:click this button and refersh the page ,when the count not display, when you click the show count button session storage item will be clear
</div>
<br>
<div>
show count :it is remove the session item
</div>
JavaScript
$(document).ready(function () {
if(sessionStorage.getItem('count')){
$("#count").remove();
}
$("#notif").click( function () {
$("#count").remove();
if(!sessionStorage.getItem('count')){
sessionStorage.setItem("count", true);
}
}
);
$("#sessionclr").click( function () {
sessionStorage.removeItem("count");
location.reload();
}
);
});