Hussy Hussy - 7 months ago 9
Javascript Question

How to check whether a value is a number in javascript or jquery


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 javascript to do this?

HTMl is

<g:textField name="miscCharge" id ="miscCharge" value="" size="9" max="100000000000" min="0" />

zad zad
Answer
function isNumber(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
}