Created
May 31, 2017 09:10
-
-
Save jmleroy/50974a30820570e18c814db6491bd368 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("body.refunds.home.rmcuser #idf").on( | |
"keypress", | |
function (e) { | |
var charCode = (typeof e.which == "undefined") ? e.keyCode : e.which; | |
var charStr = String.fromCharCode(charCode); | |
return /\d/.test(charStr) // number | |
|| e.keyCode == 37 || e.keyCode == 39 // left and right arrows | |
|| e.keyCode == 36 || e.keyCode == 35 // home and end | |
|| e.keyCode == 8 || e.keyCode == 46 // backspace and delete | |
|| (e.ctrlKey && (charStr == 'v' || charStr == 'V')); // paste | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment