So I want to validate a textbox that I have, the user can leave this box blank which is fine. However if they enter the number 0 in it, I want an error message to appear. However if it say is it null, it validates as an error when it is empty as well.
I have done is it equal to “0” in quotes, however if they put more than one 0 it accepts it. So what can I do to validate to check if it is 0, but not null.
I tried loads, this is my latest try, but nothing works
if (this.value == 0 && this.value != null){
}
Thanks
What “Rhumborl” said works great 🙂
should work for decimals. you shouldn’t need parseInt as well.