<head>
<script>
document.getElementById("count-el").innertext = 3
</script>
</head>
<body>
<h1>People entered</h1>
<h2 id="count-el">0</h2>
</body>
</html>
innertext is not getting changed from 0 to 3.
<head>
<script>
document.getElementById("count-el").innertext = 3
</script>
</head>
<body>
<h1>People entered</h1>
<h2 id="count-el">0</h2>
</body>
</html>
innertext is not getting changed from 0 to 3.
There are two issues.
The <script> tag should be inside your <body>, ideally at the bottom.
You have spelled innerText
incorrectly.
alternatively, you can use innerHTML
or textContent
as well
document.getElementById("count-el").innerText = 3
<h1>People entered</h1>
<h2 id="count-el">0</h2>
<body>
<h1>People entered</h1>
<h2 id="count-el">0</h2>
<script>
document.getElementById("count-el").innerText = 3
</script>
</body>
` tag and second there is no such `innertext`, You should use `innerText`
– DecPK Aug 17 '21 at 07:13