Since "keyup" will be triggered when the ANY key is pressed, you simply will not specify if ...
$('input').keyup(function (e){
By combining this in your current code, you can do something like ...
$('input').keyup(function (e){ alert('a key was press'); if (e.keyCode == 13) { alert('and that key just so happened to be enter'); } })
source share