# Submit form on enter press

**URL:** <https://forum.kirupa.com/t/submit-form-on-enter-press/168926>\
**Category:** web dev\
**Created:** [November 11, 2005, 9:05am UTC](https://forum.kirupa.com/t/submit-form-on-enter-press/168926 "2005-11-11T09:05:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tommythewolfboy](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@tommythewolfboy](https://forum.kirupa.com/u/tommythewolfboy)\
**Post date:** [November 11, 2005, 9:05am UTC](https://forum.kirupa.com/t/submit-form-on-enter-press/168926/1 "2005-11-11T09:05:25Z")

</div>

Hi,

Wonder if anyone can help …  
I’ve set up a basic login form (see below), but have been asked to use a standard text hyperlink for the Login ‘button’. The problem with this is that users must actually click on the link to post the form details - if I was to use a standard submit button then they could simply press enter to send the details. Does anyone know how I can achieve this functionality with a hyperlink (i.e. logging in when enter is pressed, not just when clicked)? Perhaps something can be done with focus?! I did try an alternative, of using a submit button and styling it to look like a text link, but thought that there must be a much easier way to do it!

Thanks!

Tom

```auto
<form name="form1" method="post">
<form name="form1" method="post">
<label>User ID: <input name="tUser" class="fbox" style="width: 118px; margin-right: 3px;" type="text"></label>
<label>Password: <input name="tPassword" class="fbox" style="width: 118px; margin-right: 3px;" type="password"></label><a href="javascript:loginSubmit();document.form1.submit()" class="arw">Login</a><br>
<a href="javascript:forgotPass()" class="arw">Forgot your password?</a></form>

```
