469,276 Members | 1,774 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,276 developers. It's quick & easy.

Script to Open Select box

4
Hi,
Ihave a requrement where I need to keep selec box in open state when a value in second box in "NO'


Is there a way I can keep select box in open state?

Thanks
Mar 19 '08 #1
7 2405
mrhoo
428 256MB
set the size attribute of the select element to expose that number of options-

el.size=el.options.length+'',
or el.size=el.selectedIndex+'',
or el.size='6'
Mar 20 '08 #2
sammus
4
Thanks for the reply

Its a dropdown list box/select box
If I set el.size='6' , it will convert it to ListBox i want to keep it as dropdown select box, but only expanded or in open state
Mar 20 '08 #3
acoder
16,027 Expert Mod 8TB
Why would you want to do that?

It's open when the user clicks on it. When it's in that state, the user is expected to select an option (which closes it again).
Mar 20 '08 #4
sammus
4
its the feature requested by our client
I have no idea how to call onclick event,
is there a way to pass key values so that dropdown box can be in open state??
Please help me
Mar 25 '08 #5
acoder
16,027 Expert Mod 8TB
If it's a client request, tell them not everything is possible. The browser is the interface, so you're restricted by what the browser allows. I've not tried, but you may look into mutation events/fireEvent.

Why not just give the focus to the select element instead? This will allow users to select options using the keyboard, though they won't be able to see all the options unless they click on it.
Mar 25 '08 #6
sammus
4
Focus is for the dropdown/select box, they want that to be in an open state
i tried calling onclick event in javascript, but its like calling the function to perform some operation, it won't open the dropdown list.
Mar 25 '08 #7
acoder
16,027 Expert Mod 8TB
If it's not possible, it's not possible.

Manually firing events doesn't always work, e.g. mouse and key events (if manually fired) don't always work as expected for security reasons.
Mar 26 '08 #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by Dan Foley | last post: by
reply views Thread by Mark Griffin | last post: by
3 posts views Thread by Lyle Fairfield | last post: by
1 post views Thread by Rob | last post: by
1 post views Thread by wannieb | last post: by
2 posts views Thread by m19peters | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.