View Full Version : Two Columns in Dropdown Box

12-27-2006, 03:43 AM
Hi. Is it possible to have two columns inside a dropdown or select box?
The thing is that I have records from two separate fields in a database and I want to display it in the select box so that it looks neat.


12-27-2006, 07:30 AM
I've done a little research and I really don't think this is possible. Your options are to use the <optgroup> tag to physicall separate (although vertically) the different sets. You can manufacture two columns in one select box with periods or spaces in between. Finally, you could use some tedious javascript to make your own 2 column select box. You could either have an invisible <div> tag with 2 layers in it pop up when the user clicks, or you could have one select box and an invisible one right next to it, and whenever a user clicks the one select box, the other becomes visible and simultaneously open. At least, I think you can make a select box open with javascript, although I'm not sure how.