A textbox only allows visitor to type numeric, dot, and minus sign. This will replace the half-ass HTML5 input type=number
A working sample is here https://rawgit.com/lockevn/html-numeric-input/master/index.html
- Support positive and negative number
- Support decimal number (with dot)
- This is vanilla JS, no library required
- Tested on Chrome, Firefox, IE10, IE11
- Tested on Windows, the keycodes is taken from http://keycode.info