Multiple Selection Display Style SELECT Element Without Multiple Selection

I want to have an element that is displayed in a multiple-choice display style (it is a field instead of a drop-down list), but it only allows you to select an item at a time. Is it possible?

+5
html
May 22, '09 at 21:11
source share
4 answers

This will display the style selector as a list, which allows you to select only one selected item at a time:

<select size="3"> <option>1</option> <option>2</option> <option>3</option> </select> 

The value of the size attribute will determine the number of lines visible in the control. If you want to allow multiple items to be selected, add the multiple attribute to the select element:

 <select size="3" multiple="multiple"> 
+13
May 22 '09 at 21:15
source share

The way that SELECT elements are rendered is implementation dependent. The fact that in most browsers multiple = "1" you get (possibly scrolling) the option field, and multiple = "0", you get a drop-down list.

There is no standard for saying "I want the list box to allow one option to be selected."

See also:

http://www.w3.org/TR/html401/interact/forms.html#h-17.6

+4
May 22, '09 at 21:19
source share

You can write js that will deselect additional onclick options

+1
Jun 04 '09 at 22:32
source share

What about an ordered list <ol> or an unordered list <ul> with links for list items <li> ?

0
May 22, '09 at 21:18
source share



All Articles