I am very new to javascript and just started 2-3 months ago. Please forgive me if the answer is obvious. I would like to create a memorial section for my chihuahua blog, where people can light a candle for their lost pup. I'd like it to show how many candles have been lit, all time. I have come up with this:
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">Light a Candle</button>
<p id="candle"></p>
<script>
const candleLit = " Candles lit"
var count = 0;
function myFunction() {
document.getElementById("candle").innerHTML = ++count + candleLit
}
</script>
</body>
</html>
It does work, but when I refresh the page the count is gone. I assume I need some kind of database to do this? I have access to a database on my website, but don't know how to work with it or connect it. Can someone help me figure out what I need to progress with this?
Thank you for your valuable time.