onkeydown = function(e){ if(e.ctrlKey && e.keyCode == ('S').charCodeAt(0)) { e.preventDefault(); //your saving code } }