// javascript regex for numbers and dot ex : 2.2 function validate(s) { var rgx = /^[0-9]*\.?[0-9]*$/; return s.match(rgx); }