"keydown" is an event used in writing software that is triggered when a key on the keyboard is being pressed. It usually precedes the event "keyup".
Questions tagged [keydown]
1434 questions
-1
votes
1 answer
keydown on document is not working when clicked on page?
I am using
$(document).keydown(function (event) {
alert(event.keyCode);
});
This function works great when the page is loaded..Now when i click on any part of the page and then when i press any key this event is not firing and alert does not…

Ravi Tuvar
- 191
- 1
- 2
- 14
-1
votes
1 answer
Unbind (override) keydown event
I wrote a simple WordPress plugin the other day that saves a post and shows a preview. Here is the javascript.
jQuery(document).ready(function($){
if (document.cookie.indexOf("previewCookie") >= 0){
//expires added for IE
…

FajitaNachos
- 1,000
- 8
- 21
-2
votes
1 answer
Javascript addeventlistener working without parameters
I was looking for javascript documentation and found this
const log = document.getElementById('log');
document.addEventListener('keydown', logKey);
function logKey(e) {
log.textContent += ` ${e.code}`;
}
I don't understand how logkey function…

Shivam Tanwar
- 53
- 4
-2
votes
1 answer
why Task delay not working in Window_KeyUp and Window_KeyDown methods?
I have three buttons. The timer should have started when I pressed any of the 3 optional buttons. For example. When I press the blueHeadTopBtn button, the timer starts. If I press one or both of the remaining 2 buttons in 1 second, it gives value to…

Davron Omonov
- 7
- 1
-2
votes
4 answers
why is my square (snake) only moving diagonally?
I am coding 2 snakes/cars and my first snake/car, which use the WASD keyboard format, works perfectly.
But my second snake/car, which uses the arrow keys, is only moving diagonally.
I want both snakes/cars to move in every direction (up, down,…

i'm sorry
- 53
- 5
-2
votes
3 answers
Is it possible when i click a link that it does the same action when you press a specific key?
I have a slider that when you press left or right key arrow, the carroussel moves to the prev or next image.
Is it possible that if i click a div or a link or something it does the same as if i was pressing one of the arrow keys?
Thanks!

Vander
- 79
- 9
-2
votes
1 answer
WinForms Canvas KeyDown event not fired
Canvas KeyDown Event not working
I have set KeyPreviou on my form to true.
I have set canvas Focusable to true.
I Focus on my canvas control when Mouse is pressed
Any info on this matter did not help me.
Any ideas?
-2
votes
2 answers
How to use window's keydown listener for keys Chrome uses as shortcuts?
Strange problem I've come across running this code in Google Chrome:
window.addEventListener('keydown', function (event) {
console.log(event)
})
While I see the log for some keys ("w", "a", "s", spacebar, "esc", for example) - other keys do not…

Jona
- 1,023
- 2
- 15
- 39
-2
votes
2 answers
Textbox can't scan many number, just can Scan one number Barcode only
When I scan the barcode, it just shows me the one number barcode in the database only. My other long number barcodes no show out
private void textBox4_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
…

LauTan
- 23
- 5
-2
votes
2 answers
c# form keydown(changing variable)
I have a problem. I want to change this variable when I press an arrow key on a keyboard.
int rev = 0;
So I came up with this
public void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
switch (e.KeyValue)
{
…
-2
votes
1 answer
Why is my WPF KeyDown handler not catching CTRL+A?
I have a ListView with the following KeyDown event handler:
private void ListViewOnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.A)
{
Debug.WriteLine("KeyDown is A");
if (Keyboard.IsKeyDown(Key.LeftCtrl) ||…

ProfK
- 49,207
- 121
- 399
- 775
-2
votes
4 answers
HTML textboxes are not working
I want to redirect from current to nextpage on F1 button click. The page redirects properly, but the textboxes of the current page are not working.
$(document).ready(function () {
$("body").keydown(function (e) {
e.preventDefault();
…

CodingFriend
- 149
- 1
- 12
-2
votes
2 answers
C# Windows Forms PictureBox moving with Keys (w,a,s,d) doesnt work because wrong selection? (Coding NewBie)
I'm planning on doing a Jump and Run, so I need a moving pictureBox if I press W / A / S / D or something like that. I'm currently using the source code down there.
The Problem I have right now is, that I've got a lot of Buttons, other Picture…

Vincent Gleim
- 5
- 3
-2
votes
3 answers
Key combination (CTRL + F9) causing calling method which should be called only when F9 is pressed
I'm working on WPF application, and I'm showing modal/form when Key Combination is pressed, so in my case it is CTRL + F9,
so here is my code:
//Listening on Window_PreviewKeyDown any key pressing
private void Window_PreviewKeyDown(object sender,…

Roxy'Pro
- 4,216
- 9
- 40
- 102
-2
votes
1 answer
wpf keyDown in while loop
I am working on project called IAT. In two words, there are 2 categories in top corners (left, right), and a list of words, connected with these categories, randomly showed in the center of screen (1 word matches only one category).
After word is…

Alexander Blinov
- 3
- 1