Posted By

penguin999 on 10/04/07


Tagged

key jquery enter


Versions (?)

Who likes this?

14 people have marked this snippet as a favorite

vali29
heinz1959
AgentPhoenix
yetanother
korzhik
LeeRJohnson
xida
d0ri0
seanpowell
aegony
lamebollock
typomatic
wirenaught
ringo380


Check for enter key using jQuery


 / Published in: JavaScript
 

  1. $('#input_text').keyup(function(e) {
  2. //alert(e.keyCode);
  3. if(e.keyCode == 13) {
  4. alert('Enter key was pressed.');
  5. }
  6. });

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: ofadlaoui on September 29, 2010

Thank you. Really helped me :)

Posted By: mrglover on October 30, 2010

this code was GREAT helped me add a very useful feature for quick search.

one thing I noticed specifically on asp.net web form is right after the "alert" or whatever you have that executes, add a "return false;" which will stop the form submission. (worked for me).

You need to login to post a comment.