Reputation: 2539
Is it possible to detect keypresses without selecting anything on screen? I'm trying to make an online version of the Window's calculator. My searches so far have been fruitless; all I can find is how to detect keypresses in textboxes.
Upvotes: 2
Views: 937
Reputation: 21742
Set the focus on a hidden input element and catch the keypresses with javascript.
Upvotes: 0
Reputation: 6851
You should use a javascript library to intercept the keypress in a browser.
Upvotes: 1
Reputation: 1038770
My searches so far have been fruitless; all I can find is how to detect keypresses in textboxes
That's because in a web application that's the best you could do. You can intercept key presses only on elements that have the focus.
Upvotes: 6