JQuery handling keyboard events like keypress ,keyup, keydown and key number Part 2

preview_player
Показать описание
Keyup
$(document).ready(function() {
$(document).keyup(function(){
//alert('hi');
});
})
Keyup event works for all keys including non printing keys like Esc , Shit , arrow keys etc

Keydown
When we press a key the keydown event occurs.
This event is triggered for all the keys ( including non-printing keys like Esc, Shift, arrow keys etc)
Keypress

Event is triggered when a key is pressed

What is the difference between keypress and keydown events ?
The keypress event is not triggered by the non-printing keys like Esc, shift key , delete key etc , whereas all keys are tracked by keydown event. If you are script needs to track the arrow key presses then you must use keydown event as keypress event can’t detect event associated with non-printing keys like arrow keys.
keydown() event is case insensitive
keypress() event is case sensitive
Here is the code to get the difference
Рекомендации по теме
Комментарии
Автор

Sir, keypress event is triggered multiple times until the pressed key is released but the keypress event is triggered once...

veerababudevarapalli
Автор

I'm sorry sir for this question. I hope you have warm heart to answer me. I'm a video editor.
But I want make application that can read what key press even this application is not focused/active (show behind other window)

Can you give me advice or recommendation. How to code that application still can run and can read/get keypressed even it is not focused/active.

I've make a application to show what button press, but when it goes to other apps. It can't read/know what key I have press. Sorry for my english, thanks. I'm very respectfull if you want answer my question.

bodgaming
join shbcf.ru