I\'m trying to do a function if enter is pressed while on specific input.
What I\'m I doing wrong?
$(document).keyup(function (e) { if ($(\".inpu
$(document).keyup(function (e) { if ($(".input1:focus") && (e.keyCode === 13)) { alert('ya!') } });
Or just bind to the input itself
$('.input1').keyup(function (e) { if (e.keyCode === 13) { alert('ya!') } });
To figure out which keyCode you need, use the website http://keycode.info