I'm trying to validate some of the field in my form.
and I want to check if they have input the correct area code of the required field.
The area code should be one of 212, 313, or 414
This is homework so I can't use regular expression, and I'm not really asking for an answer but here is what I'm trying to use but non of them really worked for me
if (input.substr(0,2) != 212|| input.substr(0,2) != 313 || input.substr(0,2) != 414)
Message += " <p>Sorry but you have enter wrong area code!!!</p>";
I've tried used substring indexOf but really I don't know non of them really correct in this case.
Is there anyway to validate but not with the regular expression?
Thanks
alert(input)and see what happens.