我有这段代码,它正在从文本框中读取值,我认为在尝试 parseInt() 之前检查 '' 是安全的,但显然不是。
我收到错误消息:
未捕获的类型错误:无法调用未定义的方法“toLowerCase”
使用此代码:
var total = 0;
$.each('.reg-input', function () {
if ($(this).val() == '') {
}
else {
total += parseInt($(this).val()); //this line throwing error
}
});
if (total == 0) {
$('.RegisterContainer').hide();
}