I want to make an alert when the user do Ctrl+F on the page. But I tried to do keydown just like below.
$(document).keydown(function(e){
    if (e.keyCode == 17 && e.keyCode == 70) {
        alert('Hello World!');
    }
});
I want to make an alert when the user do Ctrl+F on the page. But I tried to do keydown just like below.
$(document).keydown(function(e){
    if (e.keyCode == 17 && e.keyCode == 70) {
        alert('Hello World!');
    }
});
You can use ctrlKey function of javascript with key 'F'
$(document).keypress("f",function(event) {
  if(event.ctrlKey)
    alert("Find key.");
});
try :
$(document).keydown(function(e) {
        if (e.keyCode == 70 && e.ctrlKey) {
            alert('ctrl F');
        }
    });
just use .ctrlKey property of the event object that gets passed in. It indicates if Ctrl was pressed at the time of the event.
$(document).on("keypress","f",function(e) {
  if(e.ctrlKey)
    alert("Ctrl+F");
});