How to detect Enter key in Jquery

Author:Kostas Sp Published On:November 10, 2014 Under:Jquery


In this post I will explain how to easily detect Enter key in Jquery.



In order to detect Enter key in Jquery I assume that you already have a textbox element with id = findbyName in your HTML code.

So when pressing ‘Return-Enter’ on search key input field the your_code_here() function
will be executed.

	if(e.which == 13) {
		return false;

I presume that the your_code_here(); function will take the contents of the textbox #findbyName
and will feed a search function with what you typed in the textbox.


Leave a Reply

seven − = 4


Anything in here will be replaced on browsers that support the canvas element