基本上我试图从这个div中获取一个数字,它只包含这个数字。现在,一旦我抓住它,我想添加一个,但我无法得到这个工作。我成功地抓住了这个号码,但是当我加入它时,这个号码似乎不能正常工作。从文本中获取数字并用jquery添加一个
让我给你举个例子:
Div has the number 10 in it.
Jquery runs on it.
Div has the number 11 in it.
这是预期,而是,它改变了号码1后,我添加到它,我不知道为什么。
这里是我的代码:
$(".postvotenumber").text(parseInt($(".postvotenumber").val()) + 1);
所以这个代码不加入一个当前的数量,而只是使其之一。我该如何解决?谢谢!
变化.VAL()与.text区段() – StaticVoid
谢谢:)这工作 –