Revision: 12392
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 12, 2009 17:17 by blackf0rk
Initial Code
function valNum(inNum { var RegEx = /[0-9]{1,8}\.?[0-9]{0,2}/; var ValidNumber = inNum.match(RegEx); return ValidNumber; }
Initial URL
Initial Description
Validating a decimal such as a measurement of time or currency (10.5 or 0.4). This function will return the correct number. If you feed in "10.5foo" the function will spit back 10.5. If you feed in "bar" the function will return nothing.
Initial Title
Validate Decimals with Javascript
Initial Tags
validation
Initial Language
JavaScript