As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
/^\d+$/.test(myNumber) === true
function isNumeric(val) { var numeric = true; var chars = "0123456789.-,+"; var len = val.length; var char = ""; for (i=0; i<len; i++) { char = val.charAt(i); if (chars.indexOf(char)==-1) { numeric = false; } } return numeric; }
One more robust solution maybe is YAHOO.lang.isNumber(myNumber), which is available if you are using share. http://developer.yahoo.com/yui/docs/YAHOO.lang.html#method_isNumber