我有一个简单的html块,如下所示:
<span id="replies">8</span>
使用jquery,我尝试将值(8)加1。
var currentValue = $("#replies").text();
var newValue = currentValue + 1;
$("replies").text(newValue);
实际情况是,它看起来像这样:
81
然后
811
而不是9,这将是正确的答案。我做错了什么?
https://stackoverflow.com/questions/460172
复制相似问题