草庐IT

votevalue

全部标签

javascript - 在 javascript/jQuery 中将字符串转换为数字

一直在尝试将以下内容转换为数字:1varvotevalue=parseInt($(this).data('votevalue'));我也试过Number()但在检查结果时我仍然得到NaN。我做错了什么?完整代码如下:12345678910$('#button-groupbutton').each(function(){$(this).click(function(){$(this).addClass('active');varvotevalue=parseInt($(this).data('votevalue'));varfilename=$('.mainimage').data('f

javascript - 在 javascript/jQuery 中将字符串转换为数字

一直在尝试将以下内容转换为数字:1varvotevalue=parseInt($(this).data('votevalue'));我也试过Number()但在检查结果时我仍然得到NaN。我做错了什么?完整代码如下:12345678910$('#button-groupbutton').each(function(){$(this).click(function(){$(this).addClass('active');varvotevalue=parseInt($(this).data('votevalue'));varfilename=$('.mainimage').data('f