> Does [0-9] need to be in quotes?
No, it needs to be placed inside forward slashes to be considered as a regular expression. Of course, if you place them inside quotes, you need to explicitly use the RegExp() constructor.
@vishalanuj
That regex won't work. Try something like:
// This restricts the pin code to only digits with at least one
// digit required.
/^[0-9]+$/.test(txtField.value)
Last edited by ~s.o.s~; Oct 13th, 2009 at 12:53 pm.
Super Moderator
Featured Poster
Reputation Points: 3241
Solved Threads: 719
Failure as a human
Offline 8,873 posts
since Jun 2006