我想做这个
var x=$(this).attr('id');
var y = x+1;
其中 x 是整数
但是我得到的值是x1
如果 x=15,我如何得到 16?
谢谢 吉恩
最佳答案
到目前为止,所有答案都缺少 radix参数
var x=parseInt($(this).attr('id'), 10);
var y = x+1;
关于javascript - 使用 jquery 添加,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3194086/