javascript: capture CTRL+S
2019-04-05 00:00:00
IN1
,
2023-04-10 14:16:30
IN1
A cross-browser method to capture key combination CTRL+S with native JavaScript.
$(window).bind('keydown', function(event) {
if (event.ctrlKey || event.metaKey) {
switch (String.fromCharCode(event.which).toLowerCase()) {
case 's':
event.preventDefault();
console.log('capture: CTRL+S');
// do your stuff...
break;
}
}
});