Linked Questions

403 votes
6 answers
551k views

Is there is any function like isNumeric in pure JavaScript? I know jQuery has this function to check the integers.
Duke's user avatar
  • 37.3k
128 votes
3 answers
190k views

Possible Duplicate: Validate numbers in JavaScript - IsNumeric() var miscCharge = $("#miscCharge").val(); I want to check misCharge is number or not. Is there any method or easy way in jQuery or ...
Hussy's user avatar
  • 2,029
40 votes
10 answers
79k views

How can I check that a variable is a number, either an integer or a string digit? In PHP I could do: if (is_int($var)) { echo '$var is integer'; } Or: if (is_numeric($var)) { echo '$var is ...
Richard Knop's user avatar
  • 84.2k
45 votes
6 answers
231k views

My guess would be: function isNumber(val) { return val === +val; } Is there a better way? Previous Reference Validate decimal numbers in JavaScript - IsNumeric()
nativist.bill.cutting's user avatar
3 votes
3 answers
8k views

I have a code that takes some numbers from a user.I want to ensure that the data given from the user are numbers and not strings.From my knowledge to vb6 I know i can use IsNumeric so I was wondering ...
stranger4js's user avatar
8 votes
2 answers
3k views

I have an input field, that only allows numbers and one point. $('.number').keypress(function(event) { var $this = $(this); if ((event.which != 46 || $this.val().indexOf('.') != -1) &...
peace_love's user avatar
  • 6,513
4 votes
2 answers
9k views

Possible Duplicate: Validate numbers in JavaScript - IsNumeric() Hi I am trying to validate a field using javascript to ensure that the field is not empty AND only contains numbers I am using ...
Neil's user avatar
  • 2,519
5 votes
4 answers
628 views

I'm simply trying to evaluate if an input is a number, and figured isNaN would be the best way to go. However, this causes unreliable results. For instance, using the following method: function ...
Ky -'s user avatar
  • 32.4k
1 vote
3 answers
4k views

I coded this: isNumberNotZero: function (num) { // Return false if num is null, an empty string or zero if (num === null || typeof num === "undefined" || (typeof num =...
Samantha J T Star's user avatar
4 votes
2 answers
3k views

Can anyone help me out to found a solution to validate a text field to accept a valid decimal number. I tried something like function fun_AllowOnlyAmountAndDot(txt) { if (event.keyCode > 47 &...
ravi's user avatar
  • 417
2 votes
1 answer
3k views

I have an input field and one button. When the user clicks the button, first I check whether they entered a number or not. If it is a non-numeric string then nothing should happen. If it's a number ...
naresh kumar's user avatar
  • 2,261
1 vote
5 answers
1k views

I have the follwing code in PHP: if(is_numeric($first_name[0]) === true){ //Do something } How would I be able to do the same check using JavaScript? I also would like to get a PHP script to ...
Willem's user avatar
  • 123
0 votes
1 answer
1k views

I’m loading a JSON file a reading the values into an array using a for loop I’m concerned that sometimes the JSON file might become corrupted ie the values Im reading in might become ASCII letters ...
ben's user avatar
  • 175
0 votes
3 answers
238 views

I want my ExtJS textfield to allow only numbers and decimals (Both positve and negative) .I need a regex to allow an integer or decimal number which can be positive or negative . Should match - 1) ...
Harshal's user avatar
  • 948
0 votes
1 answer
102 views

I want a concise expression to tell me if a given value is an integer or float. When provided the input value NaN or Infinity, I want the output value to be false, so this rules out simply checking ...
atroberts20's user avatar
  • 1,111

15 30 50 per page
1
2 3 4 5
13