Russell
Russell

Reputation: 4085

Detecting normal minus and numpad minus in JavaScript onKeyDown

In JavaScript's event onKeyDown, is there anyway to differentiate a minus sign pressed in the "normal" keyboard area from one pressed in the numpad? I think they generate the same which code (at least in FireFox).

I'm trying to map an standard qwerty layout to a different keyboard mapping in a text area as a user types in, and want to ignore anything on the numeric pad.

Let me know if I'm unclear.

Upvotes: 0

Views: 445

Answers (1)

T.J. Crowder
T.J. Crowder

Reputation: 1075159

I doubt you'll be able to do it reliably cross-browser. There's an excellent writeup of keyboard events and the codes generated on various browsers on this page. I think it's getting pretty dated now, though.

Upvotes: 1

Related Questions