javascript switch keycode code example
Example: how to insert keycode in switch statement in javascript
$(window).on('keydown', function (e) {
e.preventDefault();
if( e.KeyCode == 8 ) {
$('div').append('<p>if</p>');
}
switch (e.keyCode) {
case 8: // Backspace
$('div').append('<p>switch</p>');
break;
}
});