I'm trying to make a simple program that stores the h1 value in a variable and then store it in a cookie. But whenever I reload the page the h1 value always goes back to 0 and is not being saved. Can someone please explain how I can save the variable in a cookie so when I reload the page it stays there.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div class="container">
<h1 id="hs">1 </h1> <img src="image01.jpg" width="960" height="640" />
<button onclick="increase()" id="d">Increase value of cookie</button>
</div>
<script src="cookies.min.js"></script>
<script>
Cookies.set('name', 'leo');
Cookies.set('nams', 'ddleo');
var h = document.getElementById("hs");
function increase() {
var values = parseInt(document.getElementById('hs').innerHTML, 10);
values++;
Cookies.set("name", values);
document.getElementById('hs').innerHTML = Cookies.get("name", values);
}
</script>
</body>
</html>