I am working on an application where I need to detect whether user has pressed ctrl+f6 for certain navigation path. How to capture ctrl+f6 key press event in javascript/jquery?
Asked
Active
Viewed 725 times
-1

Misha Akopov
- 12,241
- 27
- 68
- 82

Sayantan Ghosh
- 998
- 2
- 9
- 29
-
1Possibly the answer lies in this question https://stackoverflow.com/questions/424407/handling-key-press-events-f1-f12-using-javascript-and-jquery-cross-browser – John Rodney Dec 05 '17 at 10:32
-
Right. Missed it somehow. Thanks :) – Sayantan Ghosh Dec 05 '17 at 10:44
1 Answers
3
Hope this helps (source)
$(window).keydown(function(event) {
if(event.ctrlKey && event.keyCode == 117 ) { //f6 keycode
console.log("Hey! Ctrl + F6 event captured!");
event.preventDefault();
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Hit Ctrl + F6 to see console log on this event.

Krzysztof Janiszewski
- 3,763
- 3
- 18
- 38