[英]getting NaN, not increment the attribute value
alert($(this).attr("data-itemindex"));
给我'999999999999999003'
和alert(dataValue);
正在给“ NaN”
但为什么?
我期望'999999999999999004'
alert($(this).attr("data-itemindex"));
var dataValue = Number($(this).attr("data-itemindex")) + 1;
alert(dataValue);
如果您想尝试以下方法:
https://github.com/rauschma/strint
使用示例:
var strint = require("./strint");
strint.add("9007199254740992", "1")
//'9007199254740993'
这正在工作
var dataValue="'999999999999"+("000"+(parseInt($(this).attr("data-itemindex").slice( -3 ),10) + 1).toString()).slice(-3)+"'";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.