Running A Function When Enter Is Pressed In A Text Box
This is my input form: I basically want a Javascript function to execute when the person presses enter in the text box. I'm sorry if this is
Solution 1:
$('#word').on('keyup', function(e){
if(e.which === 13){
// User pressed enter
}
});
Testing the event which
property will tell you what key the user has pressed.
which
is normalized by jQuery, so you won't have any cross-browser issues.
Post a Comment for "Running A Function When Enter Is Pressed In A Text Box"