[英]getting NaN, not increment the attribute value
alert($(this).attr("data-itemindex"));
is giving me '999999999999999003' 给我'999999999999999003'
and alert(dataValue);
和
alert(dataValue);
is giving 'NaN' 正在给“ NaN”
but why? 但为什么?
I am expecting '999999999999999004' 我期望'999999999999999004'
alert($(this).attr("data-itemindex"));
var dataValue = Number($(this).attr("data-itemindex")) + 1;
alert(dataValue);
if you would like to try this: 如果您想尝试以下方法:
https://github.com/rauschma/strint https://github.com/rauschma/strint
example of use: 使用示例:
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.