Javascript for validating numbers in textbox

you didn't say why or what is not working properly! Unfortunately, I tried it and it didn't seem to work, whereas the previous (longer) solution did.

it's been a while since I've coded, but I'm unfamiliar with this syntax.

Did you want the user to be able to enter a decimal on top of the one that is already there?

Our article regarding “Allow Only Number or String in Text Box using Java Script” or Set numeric or alphabetic validation in Text Box using javascript or Textbox input check using Java Script.

For example if you want A-Z, then the range is [65, 90], and a-z is [97, 122]does not work in either Chrome or Firefox.

You may be referring to submission validation of non-numeric characters, which does work properly with HTML5.

Your code thinks the textbox already has a decimal point and returns false. Hi goodideadave, I have tested this with IE8 and FF3.

Net Question Answer site, specially started to allow visitors of this site ask their doubts and queries. Just click the Ask Now button and ask your question now.Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific [email protected], here's the ASCII table: Depending on what you mean by letters the result will be different.The user can enter .25, 0.25, 1.25, and so on, with either a leading zero or not and only one decimal place.I have seen a few solutions that work with either no leading zero or with only one decimal place, but not both. Thanks for your help, but check For Second Decimal doesn't work when there is already a number with a decimal point in the textbox.

Leave a Reply