Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://jsfiddle.net/hibbard_eu/vY39r/
- $("#amount").on("keyup", function(){
- var valid = /^\d{0,2}(\.\d{0,2})?$/.test(this.value),
- val = this.value;
- if(!valid){
- console.log("Invalid input!");
- this.value = val.substring(0, val.length - 1);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement