Events execute when you press the button?

How to make so that when you press (English K) the following:
alert("K pressed");
September 19th 19 at 12:05
2 answers
September 19th 19 at 12:07
Solution
$(window).keydown(function(event) {
 if (event.keyCode == 75) {
 alert("K pressed");
}
});
Thanks, but it seems the code letter is 75 - douglas_Wehner commented on September 19th 19 at 12:10
: Yes, 75. My mistake. Fixed. - donny_Breitenberg99 commented on September 19th 19 at 12:13
September 19th 19 at 12:09
Events keydown/keyup occur when pressing/releasing keys and allow you to receive the scan-code in the keyCode property
And Cho - douglas_Wehner commented on September 19th 19 at 12:12

Find more questions by tags JavaScript