I'm attempting to make a simple click counter. I believe my JS is sound, but I'm not getting any functionality from the HTML button calling it.
I've tried calling my JS function from the HTML button using..
<button onclick="addOne()"
..but the button simply isn't producing an output. Below is a sample of the issue which features my JS function and HTML.
<body>
<div>
<h1><span id="thisone">1</span></h1>
<button onclick="addOne()" type="submit">Button</button>
</div>
</body>
<script type="text/javascript">
function addOne(){
const foo = document.getElementById('thisone').innerHTML;
foo++;
document.getElementById('thisone').innerHTML = foo;
};
</script>
As of now, it simply presses and the number remains unchanged. I'm trying to have the number in increase by 1 each time the button is clicked.