following is my piece of code which checks if the input format is EMAIL which comes from the form input or not and validates accordingly i want to know how can i modify the following code that validates if the input was only number
if(email.length == 0 || email.indexOf('@') == '-1'){
var error = true;
$('#email_error').fadeIn(500);
}else{
$('#email_error').fadeOut(500);
}
I would use:
In this case the
(email*1)have the possibility to evaluate toNaN, and thus will fail the check because the list of falsish values are0,"",false,null,undefined,NaN