I have a form where the user has to insert either a "+"
sign, a "-" sign, or can leave the field blank.
The problem is I'm finding it difficult to validate the
input. I've tried using "\+" for the + sign (as it's a
metacharacter) but I can't seem to get it to work.
code at the moment is very simple
I have the variables from the form and then just
Code:
if (sign.value != "\+" || sign.value != "-" || sign.value != "")
{
alert("Your value is " + sign.value + "You can only enter a +, - or leave it blank");
return false;
}
else return true;
where sign is the name of
the field. Instead of printing the value of the + or -, the
alert box is printing NaN.
Sorry if this has been answered before, I had a look and
searched all over but couldn't find anything about it.
Thanks in advance for the help