jQuery的< span>增量值标签 [英] jQuery increment value of <span> tag
本文介绍了jQuery的< span>增量值标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在span标签中有一个数字.我需要获取跨度中的数字值,然后在jQuery中对其进行递增.我知道如何在文本输入中执行此操作-可以对span标签执行此操作吗?
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 done to a span tag?
SPAN标签
<span class="changeNumber"> 33 </span>
jQuery范围选择器
jQuery span selector
var commentNumAppend = $(this).closest(".songContainer").find(".changeNumber");
推荐答案
示例-
<span class="changeNumber">33</span>
$('.changeNumber').html(parseInt($('.changeNumber').html(), 10)+1)
这篇关于jQuery的< span>增量值标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文