jQuery Keypress enter example

Previous
Next
In this post, we will see how to detect if enter key is pressed or not in jQuery.

To capture enter keypress, we will bind dom element with keypress event and if ascii value is 13, then enter key is pressed.

So basically code will look something like this.

If you want to catch keypress event in whole web page, you can simply use:

JQuery keypress enter example:

Output:

Live demo: jQuery keypress enter example

Previous
Next

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.

Add Comment

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.
You can like our facebook page Java2blog