Keyboard Events in jQuery — a practical guide to jQuery keyboard events with clear examples you can reuse in real projects.
jQuery Tutorial Series (21/101). Prefer one article? Read the complete jQuery tutorial.
Short description
Prefer keydown/keyup; check event.key for modern code.
Keyboard
$('#search').on('keyup', function (e) {
if (e.key === 'Enter') {
runSearch($(this).val());
}
});