How to Disable the CTRL+P using javascript or Jquery?

后端 未结 11 1115
一生所求
一生所求 2020-12-31 06:17

Here I tried to disable the Ctrl+P but it doesn\'t get me alert and also it shows the print options

jQuery(document).bind(\"keyup keydo         


        
11条回答
  •  星月不相逢
    2020-12-31 06:38

    had a journy finding this, should be canceled on the keydown event

    document.addEventListener('keydown',function(e){
       e.preventDefault();
       return false;
    });
    

    further simplified to :

    document.onkeydown = function(e){
       e.preventDefault();
    }
    

    given you have only one keydown event

提交回复
热议问题