I know the rules that 0 is equal to empty string '' in javascript. So how to make if statement to differ this? I mean, I have field where I insert amount value. For empty string I need one message to show but for 0 value another. Currently, I always catch 0 == ''.
if (amount == '') {
$("#validation-msg3").addClass("opux-is-visible");
return false;
}
else if (amount < 5) {
$("#validation-msg1").addClass("opux-is-visible");
return false;
}
EDIT. when I use ===
I do not get condition equals true when field is empty. What does it mean? My amount value is different type than empty string? I parse it like this:
var amount = parseInput($("#amount").val());