For this particular existing form there is an input to accept phone numbers. It already validates to only accept numbers and added a max character attribute for 10 characters.
However someone could add 1-9 digits. So I need to add javascript to check to make sure the character count for that field is 10. The input has an ID of phonenumber.
Can someone tell me how to modify the following code to make that work? Note: The "= 10 Characters" is just a placeholder, that part needs to be replaced with real code.
function checkEmail(theForm) { if (theForm.getElementById("phonenumber").value = 10 Characters ) { alert('Your phone number is not 10 digits.'); return false; } else { return true; } }
\d{10}