Asked 8 years ago
22 Nov 2016
Views 1168
jaggy

jaggy posted

how to check value is Numeric in JavaScript ?

In JavaScript . given value is Numeric or not ?
i want to check the given number is Numeric or not in HTML Form . so i can validate it properly

In JavaScript or in jQuery , any solution helps.
Mitul Dabhi

Mitul Dabhi
answered Nov 30 '-1 00:00

you can use regex to check given value is Numeric or not

 /^[0-9]+$/

use like this

var myVar =123;
var numericExpression = /^[0-9]+$/;
if(myVar .match(numericExpression)){
	alert(myVar +"is Numeric");
}
Post Answer