Why does putting focus on textbox also set focus to submit

Discussion in 'Javascript' started by jw56578@gmail.com, Jun 1, 2005.

  1. Guest

    Is there a reason why setting focus to a textbox input, also gives
    focus to a submit button on the page, to where if you click enter in
    the text box, the submit button will be clicked.
     
    , Jun 1, 2005
    #1
    1. Advertisements

  2. wrote:

    > Is there a reason why setting focus to a textbox input, also gives
    > focus to a submit button on the page, to where if you click enter in
    > the text box, the submit button will be clicked.


    So that with simple forms, such as:

    Query: [ ] [Submit]

    A user can type and press enter, rather then having to type, tab and press
    enter or type the fiddle with the mouse. Its a time saver.

    http://ppewww.ph.gla.ac.uk/~flavell/www/formquestion.html

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Jun 1, 2005
    #2
    1. Advertisements

  3. wrote:

    > Is there a reason why setting focus to a textbox input, also gives
    > focus to a submit button on the page,


    It does not, the focus stays on the input control. The only/first submit
    button is often highlighted, though.

    > to where if you click enter in the text box, the submit button will
    > be clicked.


    No, it will not. Instead, the form will be submitted, which is a different
    thing. Check out the `onclick' handler of the submit button.


    PointedEars
     
    Thomas 'PointedEars' Lahn, Jun 6, 2005
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Saurabh
    Replies:
    6
    Views:
    4,722
    Chris Smith
    May 30, 2004
  2. Neil
    Replies:
    6
    Views:
    40,275
    atilio123321
    Sep 2, 2011
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,534
    Smokey Grindel
    Dec 2, 2006
  4. S_K
    Replies:
    6
    Views:
    1,394
    Robert Dunlop
    Nov 8, 2007
  5. Replies:
    4
    Views:
    1,322
    Adrienne Boswell
    Mar 23, 2010
Loading...

Share This Page