I have this code , it is reading the value from a text box, I thought checking for ” before trying to parseInt() would be safe , but apparently not.
I am getting the error:
Uncaught TypeError: Cannot call method ‘toLowerCase’ of undefined
With this code:
var total = 0;
$.each('.reg-input', function () {
if ($(this).val() == '') {
}
else {
total += parseInt($(this).val()); //this line throwing error
}
});
if (total == 0) {
$('.RegisterContainer').hide();
}
'.reg-input'is a string,thisin that case will also be a string, not a dom element. Try this instead: