Skip to content Skip to sidebar Skip to footer

Incrementing A Number In A Div Using Javascript

I'm very new to Javascript, so I assume this is a stupid mistake. function upvote() { var score = parseInt(document.getElementById('voteScore').innerHTML); score = score++;

Solution 1:

score++ increments score, you don't need to assign it back to score. Either remove the score = or change score++ to score+1.


Post a Comment for "Incrementing A Number In A Div Using Javascript"