我有一个简单的 HTML 代码块,如下所示:
I have a simple html block like:
<span id="replies">8</span>
使用 jQuery,我正在尝试将值(8)加 1。
var currentValue = $("#replies").text();
var newValue = currentValue + 1;
$("replies").text(newValue);
出现的情况是这样的:
81
然后
811
而不是正确答案9。我做错了什么?
parseInt("010", 10)
返回十。 - jahroy