By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,905 Members | 902 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,905 IT Pros & Developers. It's quick & easy.

<label> with <select> in IE6

P: n/a
Hello,

I am used to using the label tag with check boxes and radio buttons in
html forms. This allows me to click on the text of the label to
activate/deactivate the check box / button, rather than having to
click on the (possibly small) box or button.

I recently tried to assign a label to a select "drop down list", but
found that when I clicked on the label text to bring it into focus,
the select box was reset to the first entry. Is this normal?

The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?

Is it wrong to assign a label to a select box?

Sample URL is: http://www.sindar.net/html-reference.html (scroll way
down to the bottom of the page).

Thanks,

Brian.
Jul 23 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Brian Foley wrote:
I recently tried to assign a label to a select "drop down list", but
found that when I clicked on the label text to bring it into focus,
the select box was reset to the first entry. Is this normal?
Most likely not. The Specification says only:

"When a LABEL element receives focus, it passes the focus on to its
associated control." [1]

There is no mention nor anything that would imply that an implementation
should move the selected entry, in the case of a menu element.
The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?
Hum... I can't think of anything decent.
Is it wrong to assign a label to a select box?
Definitely not!
Sample URL is: http://www.sindar.net/html-reference.html (scroll way
down to the bottom of the page).


I could confirm the reported (mis)behavior on MS IE 6.0.2900.2180 on
Windows XP SP2. Normally, one would suggest the submission of a bug
report, but I don't think IE is going to receive any attention before
Longhorn.

[1] http://www.w3.org/TR/html4/interact/forms.html#h-17.9.1

Regards,

--
Ney André de Mello Zunino
Jul 23 '05 #2

P: n/a
Ney André de Mello Zunino <zu****@inf.ufsc.br> wrote:
Normally, one would suggest the submission of a bug
report, but I don't think IE is going to receive any attention before
Longhorn.


After the recent announcement about IE 7 for Windows XP, I would be more
optimistic about this. Not very optimistic, though.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 23 '05 #3

P: n/a
/Brian Foley/:
The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?

Is it wrong to assign a label to a select box?


No, it is not wrong. It is just IE is wrong, as usual. :-)

Notice when you specify an 'accesskey' for the label (it is the only
way you could specify an 'accesskey' for a SELECT element) and use
that key to activate the select box - the "reset" behavior doesn't
happen.

--
Stanimir
Jul 23 '05 #4

P: n/a
Brian Foley wrote:
I recently tried to assign a label to a select "drop down list", but
found that when I clicked on the label text to bring it into focus,
the select box was reset to the first entry. Is this normal?

The browser I used for this test was IE 6. Mozilla does not do this.
Is there a way to make IE stop changing the selected item in the
select list when I click on the label text?


Here's a quick JavaScript workaround:
<http://tw.ecritters.biz/html_examples/ie_select_labels/>.
Jul 23 '05 #5

P: n/a
* Leif K-Brooks <eu*****@ecritters.biz> on Sun, 20 Feb 2005 06:45:42 -0500 wrote:
Here's a quick JavaScript workaround:
<http://tw.ecritters.biz/html_examples/ie_select_labels/>.


Thanks Leif -- very helpful.

I think, though, that it may simply be better to drop the labels from
my select elements. I usually lay my forms out in a two column th/td
table, so I suppose the relationship is obvious even without the
label.

Its a shame though...

Brian.
Jul 23 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.