I'm trying to create a little Javascript program that adds 1 when I click a "+" button, and subtracts 1 when I click a "-" button. It works, however when I add 1 then goto subtract one, the first click of the "-" button will add one more, before subtracting.
Eg. 1, 2, 3, 4, (then I click the "-" button) 5, 4, 3...
var number = 1;
<button type="button" onClick="document.getElementById('number').innerHTML = number++">+</button>
<button type="button" onClick="document.getElementById('number').innerHTML = number--">-</button>
<div id="number"></div>