JQUERY/소스코드
Jquery 웹개발시 F1 키 도움말 막고 단축키로 사용하기
nineDeveloper
2015. 10. 15. 19:52
728x90
반응형
//모든 곳에서 key 다운 시
$(document).keydown(function(e){
var code = e.which? e.which : e.keyCode;
if( code == 112 ){
document.onhelp = function(){ return(false);}
window.onhelp = function(){ return(false); }
alert('test');
}
});
//input, select, textarea 에서 키 다운 시
$(document).on("keydown","input,select,textarea", function(e){
var code = e.which? e.which : e.keyCode;
if( code == 112 ){
document.onhelp = function(){ return(false);}
window.onhelp = function(){ return(false); }
alert('test');
}
});
//jquery.hotkeys.js 플러그인 사용시
$(document).bind('keyup', 'f1', function(){
document.onhelp = function(){ return(false);}
window.onhelp = function(){ return(false); }
alert('test');
});
728x90
반응형