How do I know that the keyboard enter is pressed in jQuery? Is it possible? Or should I install a plug-in? I know I have to use the keypress() function, but I don't know how to use it.
javascript jquery
All browsers treat Enter as 13.
$(document).keypress(function(e) {
if(e.which == 13) {
alert('You pressed enter!');
}
});
You can do it like this.
© 2024 OneMinuteCode. All rights reserved.