Incrementing a number in a div using Javascript

前端 未结 1 1628
感动是毒
感动是毒 2021-01-22 08:48

I\'m very new to Javascript, so I assume this is a stupid mistake.

function upvote() {
    var score = parseInt(document.getElementById(\'voteScore\').innerHTML)         


        
相关标签:
1条回答
  • 2021-01-22 09:26

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

    0 讨论(0)
提交回复
热议问题