Javascript中的内联`++`无法正常工作 [英] Inline `++` in Javascript not working
本文介绍了Javascript中的内联`++`无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
惊讶地发现这样的一行:
Astonished to find out that a line like this :
$('#TextBox').val(parseInt($('#TextBox').val())++ );
无效!
我'我做了一些测试,结果是内联 ++
不起作用(在Javascript中作为一个整体?或者只是在我的例子中?)。
I've done some tests, it plays out to the conclusion that the inline ++
doesn't work (in Javascript as a whole ? Or simply in my example ?).
这是一个测试三段代码,似乎 ++
可以使用变量,但不能内联。
Here's a test with three pieces of code, it seems that ++
is ok with a variable but not inline.
所以,没有内联 ++
我们在Javascript中?
So, no inline ++
for us in Javascript?
推荐答案
jQuery对此没什么特别之处。 ++
递增变量。您正在尝试增加函数调用的返回值。
There's nothing particular to jQuery about this. ++
increments a variable. You are trying to increment the return value of a function call.
这篇关于Javascript中的内联`++`无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文