javascript regex for numpad -


i need capture pressed key 0-9 including numbers numpad. wrote function checks doesn't work on numpad digits

function getkeyval(e) {    var order = string.fromcharcode(e.keycode);    return /^\s*\d+\s*$/.test(order) } 

string.fromcharcode return "a" numpad key 1.

can help?

you can use onkeypress handler, or subtract 48 keycode. see question:

get correct keycode keypad(numpad) keys


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -