I can get it to only allow numbers only but I need help with:
- Only the first number can be bigger than 0
- The user can enter a maximum of 9 characters and a minimum of 2 characters, then they must enter a decimal point.
After the decimal they must only enter 2 more numbers.
$("#mytextbox").on("keypress", function(event) { var ValidPrice = /[1-9][0-9]/; var key = String.fromCharCode(event.which); if (event.keyCode == 8 || event.keyCode == 37 || event.keyCode == 39 || ValidPrice.test(key)) { return true; } return false; }); $('#mytextbox').on("paste",function(e) { e.preventDefault(); });