enter key to submit textbox info

If there away where if a user types into my text box and hits enter i can add the data to my db just by the enter button so i don't need to use a button??
runnerjp2005Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Gurvinder Pal SinghConnect With a Mentor Commented:
$("#id_of_textbox").keyup(function(event){
  if(event.keyCode == 13){
    //submit code
  }
});
0
 
CodeCruiserCommented:
You can also use a button and make it a default button so that pressing enter executes this button code

http://weblogs.asp.net/skoganti/archive/2004/09/20/231695.aspx

And another javascript technique

http://weblogs.asp.net/rajbk/archive/2003/12/11/setting-the-default-button-for-a-textbox-in-asp-net.aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.