简体   繁体   English

得到NaN,而不增加属性值

[英]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);

Your number is too big. 您的人数太大。 The maximum possible number is: 可能的最大数量为:

9 007 199 254 740 992

Have a look at this question . 看看这个问题

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM