I am trying to make a simple cookie clicker type game (click counter) with jQuery. I want to have a button that makes the value of clicks go up by one every second. How would I go about this and are there any errors in my coding? I'm very new to all of this.
Here's my code:
$(function() {
$('#target').click(function() {
$('#output').html(function(i, val) {
return val * 1 + 1;
});
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="box">
<button id="target" type="button">Click</button>
<div id="output">0</div>
</div>
countwhich you manipulate and display from the JS.