How do I capture a CTRL-S without jQuery or any other library?

前端 未结 7 514
别那么骄傲
别那么骄傲 2020-12-09 04:44

How do I go about capturing the CTRL + S event in a webpage?

I do not wish to use jQuery or any other special library.

Thanks for your

7条回答
  •  不知归路
    2020-12-09 05:03

    document.onkeydown = function(e) {
        if (e.ctrlKey && e.keyCode === 83) {
            alert('strg+s');
        }
        return false;
    };
    

    Some events can't be captured, since they are capture by the system or application.

提交回复
热议问题