Basically, I'm doing this:
var phone = $("#phone").val();
Then I want to check if:
1) Phone contains only numbers
2) Phone contains at least 10 digits
But the problem is, from my experience, using $("something").val()
returns it as a string so isNaN()
fails. But I don't want use parseInt()
either since it will change strings into numbers as well and then isNaN()
will always pass.
Thoughts?