Why does putting focus on textbox also set focus to submit

J

jw56578

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.
 
D

David Dorward

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
 
T

Thomas 'PointedEars' Lahn

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top