471,887 Members | 1,449 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

Number Validation

Hi,

I need to check whether the user has entered a numeric value or not in a text box using Javascript. What function can be used for this?

Thanks in advance.

Regards,
Sivakrupa
Apr 9 '09 #1
3 1416
Dormilich
8,658 Expert Mod 8TB
you could use isNaN() or the typeof operator.
Apr 9 '09 #2
That worked out.
Yeah thanks.
Apr 9 '09 #3
acoder
16,027 Expert Mod 8TB
I would recommend regular expressions, e.g.
Expand|Select|Wrap|Line Numbers
  1. /^-?\d*\.?\d+$/
Apr 10 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Laphan | last post: by
6 posts views Thread by simina | last post: by
3 posts views Thread by tdmailbox | last post: by
6 posts views Thread by JIM.H. | last post: by
2 posts views Thread by Jeff | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.