shir11 Posted September 23, 2014 Share Posted September 23, 2014 I'm new in javascript so I hope you will forgive me:) I want to validate my input text that the user will insert only 2-6 numbers. how can I do this? Link to comment Share on other sites More sharing options...
Ingolme Posted September 23, 2014 Share Posted September 23, 2014 Regular expressions are the fastest way to do it, you can learn about them at the RegExp page of the W3Schools Javascript tutorial. http://www.regular-expressions.info/ is a website dedicated exclusively to teaching regular expressions. Link to comment Share on other sites More sharing options...
niche Posted September 23, 2014 Share Posted September 23, 2014 Allowing everyone to see your validation code is problematic. Link to comment Share on other sites More sharing options...
Ingolme Posted September 23, 2014 Share Posted September 23, 2014 Allowing everyone to see your validation code is problematic. In what way? It's not really meant to be a secret, you usually are telling them outright to only put between two and six digits. As long as there is also validation on the server-side there is no problem at all. Client-side validation makes the process quicker for the user. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now