# Detect Enter Key

**URL:** <https://forum.kirupa.com/t/detect-enter-key/125529>\
**Category:** Uncategorized\
**Created:** [October 14, 2004, 3:07pm UTC](https://forum.kirupa.com/t/detect-enter-key/125529 "2004-10-14T15:07:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnLBW](https://avatars.discourse-cdn.com/v4/letter/j/3da27b/32.png) [@JohnLBW](https://forum.kirupa.com/u/JohnLBW)\
**Post date:** [October 14, 2004, 3:07pm UTC](https://forum.kirupa.com/t/detect-enter-key/125529/1 "2004-10-14T15:07:25Z")

</div>

Hi, How do you detect the enter key being pressed on a button…

I want 2 text boxes 1 for user name 1 for the password

and a button

the user enters username presses tab - enters password - presses tab - button gets focus - presses enter on the keyboard form gets submited

I can detect the enter key press but not when the button has the focus…

any suggestions

John
