/    Sign up×
Community /Pin to ProfileBookmark

How do I make a <SELECT> menu open?

Is it possible to make a <SELECT> pulldown menu open using javascript? For example, if I have:

<SELECT id=mymenu1 onchange=”MenuChange()”>
<OPTION value=”1″>Option 1</OPTION>
<OPTION value=”2″>Option 2</OPTION>
<OPTION value=”3″>Option 3</OPTION>
</SELECT>

<SELECT id=mymenu2 >
<OPTION value=”A”>Option A</OPTION>
<OPTION value=”B”>Option B</OPTION>
<OPTION value=”C”>Option C</OPTION>
</SELECT>

As soon as I select something from mymenu1, I want the javascript function MenuChange() to open up mymenu2 as if somebody clicked on the pulldown arrow. I can give mymenu2 focus (document.getElementById(“mymenu2”).focus() ) but that just highlights the first option without actually opening the pulldown. Any ideas?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@rnd_meOct 08.2008 — my idea is that you cannot do this.

the closest thing would be to change the size of the select, but that's not really the same...
Copy linkTweet thisAlerts:
@mrhooOct 09.2008 — change the size attribute to the options length and [B]then [/B]call focus-

don't forget to change the size back to 1 on blur.
×

Success!

Help @ShadowKatmandu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...