Using document.getElementById("classname").innerText is not working. I also tried to use innerHTML but it still is not working. I can see the values increment on console but its not changing on text area in the document.The code is as follows:
<!DOCTYPE html>
<html>
<head>
<title>Learn</title>
<style>
.main{
margin: 5em;
font-size: 3em;
}
</style>
</head>
<body>
<div class="main">
Hello
<div class="count">0</div>
<div class="test">
<button class="increment-btn" onclick="increment()">Increment</button>
</div>
</div>
<script>
let count=0
let counter=document.getElementById("count")
function increment()
{
counter=counter+1
counter.innerText=counter
console.log(counter)
}
</script>
</body>
</html>