473,385 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 1461
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

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

Similar topics

2
by: Laphan | last post by:
Hi All I'm after a Tax/VAT number validation script that I can tag onto the onClick event of my submit button before submission. I've seen a lot of these as server side, but I'm trying to keep...
6
by: simina | last post by:
Hi... I have a form with 4 number fields: phone area, phone number, cell area, cell number. I did a function that checks the "number" issue for all 4 fields in the same time (because the code is...
3
by: tdmailbox | last post by:
What is the proper way to set up a validation rule to only allow numbers? I want to allow both 1024 and 1024.25
2
by: Andy Eshtry | last post by:
I need to validate a textbox control using the validation control so that user can enter only string (character) type not numbers I used comparevalidator and set the "Operator" property to...
6
by: JIM.H. | last post by:
How can I grantee that user enter only number in the textbox. If possible accept ","and "." in the number. Can I do this?
9
by: campbellwarren | last post by:
Does anyone know how I could limit the number of rows allowed in a MS Access table... want to limit it to 1.
2
by: Jeff | last post by:
hey asp.net 2.0 I have a textbox on my webpage. I want to validate that the user has entered a number and not text. So I added a RegularExpressionValidator to the form, and set its...
2
by: voroojak | last post by:
Hi i just want the user can enter number not any thing else in form. i tried >like "*#*"< in validation validation rule area and it seems that it is working and put just >accept number< in...
19
Frinavale
by: Frinavale | last post by:
Filtering user input is extremely important for web programming. If input is left unfiltered users can input malicious code that can cripple your website. This article will explain how to make...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.