As 'number' is not implemented by all browsers, you can check your <input type="text" /> value with this RegExp.