jQuery increment value of tag

后端 未结 7 767
小鲜肉
小鲜肉 2020-12-31 04:12

I have a number in a span tag. I need to get the value of the number in the span and then increment it inside jQuery. I know how to do this for a text input - can this be

相关标签:
7条回答
  • 2020-12-31 04:46

    Example -

    <span class="changeNumber">33</span>
    
    $('.changeNumber').html(parseInt($('.changeNumber').html(), 10)+1)
    
    0 讨论(0)
提交回复
热议问题