The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Hitting on "Enter" on the keyboard to submit a form.

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #26536

    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:



    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)
  • The forum ‘JavaScript’ is closed to new topics and replies.