The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

Hitting on "Enter" on the keyboard to submit a form.

  • # October 23, 2009 at 4:03 pm

    Hello Chris (Great site, Appreciate all the work you put in)

    I am working on a site and the site has a form. The submit on the form is styled with text and css, so I have to use javascript to make it functional.

    But when I do that, my styling is there for the submit button, but it no longer behaves like a normal "Submit" button. I can’t just type in my user name and password and hit enter, you have to use the mouse and click the submit button.

    Any ideas how I can use the "Enter" key on the keyboard to "Submit" after I fill out the form.

    first the code for the javascript in the head:


    Second, here is the html code for form:

    # October 25, 2009 at 2:14 am


    The Enter function comes default with all browsers I have tried. But you need to have a <form> and an <input type="submit">

    You can read up on forms here:

    (I’m assuming you aren’t familiar with forms since there was no form tags attached. If this is wrong, let us know.)


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed