Here a very simple code(just getting started out):
<head>
</head>
<title>Title here</title>
<script src="index.js"></script>
<body>
<h1>People counter</h1>
<h2 id="count-element">0</h2>
<button id="increment-button" onclick="increment()">Increment</button>
</body>
</html>
Here is the index.js
let countElement = document.getElementById("count-element")
let count = 0
console.log(count)
function increment(){
count =count +1
countElement.innerText = count
}
The problem is: On clicking the button it fails:
I am using xampp on win 10(64) Even tried wampserver but both failed Tested on chrome and edge browsers BUT on codepen.io it works