long story short, i was trying to validate a phone field. ive added
the isNaN
and parseInt
for checking the " "
in the field but that said
This below never validates to true..what am i missing?
if(isNaN(parseInt(phone))){
error.text("Sorry but this phone field requires numbers only");
return false;
} else {
return true;
}
it always fails...it never reads true even when i enter a number in the field and submit. i always get the error mssg.
EDIT: I am testing input values from a form, phone
is the name of the field.
phone
is an HTML input element reference instead of the.value
of it. – Arthralgia