Below code snippet helps you to write Keystroke events in JQuery.
$('input').keydown(function(event) {
// variable event contains keystroke data
// that only accessible with .keydown()
if(event.which == 11) {
event.preventDefault();
}
});
$('input').keyup(function(ee) {
// run other event codes similarly
}); '.keydown' is the event fires when you press a key in the keyboard, where as '.keyup' fires after releasing the key.