我正在使用jQuery Globalize插件和 jQuery 验证。
对于有效的瑞典数字5.000,00
parseFloat 函数给出NaN
下面的代码/库中的错误可能是什么?
<script type="text/javascript" src="/Scripts/jquery-1.9.0.min.js"></script>
<script type="text/javascript" src="/Scripts/globalize.js"></script>
<script type="text/javascript" src="/Scripts/cultures/globalize.culture.sv.js"></script>
<script type="text/javascript" src="/Scripts/jquery.validate.js"></script>
<script type="text/javascript" src="/Scripts/jquery.validate.unobtrusive.js" ></script>
<script type="text/javascript">
jQuery(function () {
Globalize.culture('sv');
$.validator.methods.number = function (value, element) {
if (Globalize.parseFloat(value)) { // this gives NaN
return true;
}
return false;
}
});
</script>