Javascript Increment Function

<script>
var i = 0;
function buttonClick() {
i++;
document.getElementById('inc').value = i;
}
</script>
<button onclick="buttonClick();">Click Me</button>
<input type="text" id="inc" value="0"></input>

Leave a Reply

Your email address will not be published. Required fields are marked *