Hussy Hussy - 1 year ago 73
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 Source
function isNumber(n) {
  return !isNaN(parseFloat(n)) && isFinite(n);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download