show a select dropdown's options with js?

S

SAM

Le 5/9/10 11:39 PM, David Mark a écrit :
nick said:
Le 5/9/10 8:49 AM, nick a écrit :
[...]
I'm working on another Chrome extension. I want to pop the dropdown
open when the user clicks its containing <label>.
<label onmouseover="dropDown(this)" for="select_1">
blah blah ... ... :
<select id="select_1"
onclick="dropUp(this); doThat(this)">
... ...
</label>
AFAIK you don't need the 'for' attribute if the control is inside of
the label :)

You don't, but you should avoid that construct for compatibility reasons.

And the label has not to be the container of the form element,
but it may, so if ...

Clicking the label gives focus to its associated element,
the 1st step of the demand is reached.

The for attribute allows to know which DOM element will be then used.
(with gEBI, at least for others than IE)

The problem I met is that curious way that IE (6 in my tests) gives or
kept focus to this or that (the select, the submit-button ...) when
clicking here or there.
 
J

Jeremy J Starcher

You don't, but you should avoid that construct for compatibility
reasons.

Can you elaborate on that point? I wasn't aware of any issue
nesting the control inside the label.
 

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

Members online

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,205
Latest member
ElwoodDurh

Latest Threads

Top