I have a basic enquiry form on my website and I want one of the fields to ONLY accept numbers and keyboard spaces (whitespace).
Currently, the phone number field only accepts numbers using:
if(isNaN(form.phone.value))
{
alert('Due to SPAM this field will only accept numbers');
form.phone.focus();
return false;
}
When I test the form and use a keyboard space the error message is displayed. I need this field to accept numbers and whitespace. I assume people will use spaces when entering their full telephone number including country/area codes.