Limit the input box can only enter numbers,
You can also use document.execCommand ( "Undo"), is available, but a little too complicated logic, without the familiar command, equal to the program buried in a mine
Can also be directly input into the type of number, although it may be non-numeric input of existence, but to meet the normal use, it does not require complex database and interface design, to intercept illegal characters
Here to do a cleanup operation directly, you can design complex, return to the previous state
thisObj.find("#userName").bind("onafterpaste keyup",function (evt) { var my = $(this), v = my.val(); if(isNaN(v)){ my.val(v.replace(/[^\d]/g,'')); } });