14

There are questions on how to make one selection default, like this one. But I have a multiple select and want all the options to be selected initially. I found questions for something similar (like this), but not exactly what I want.

Is this possible without JavaScript?

Community
  • 1
  • 1
Pavel V.
  • 2,653
  • 10
  • 43
  • 74
  • Often, on webpages or native apps alike, the behavior of no selection is the same as all selected. If you do that, you can default to blank selection. Don't know if that makes sense for what you're doing? – Antoine Nov 26 '13 at 13:32

2 Answers2

13

http://jsfiddle.net/UgHT5/ is this your need?

<select multiple>
    <option selected>a</option>
    <option selected>b</option>
    <option selected>c</option>
</select>
qiu-deqing
  • 1,323
  • 7
  • 13
5

It's much easier than I expected:

<select multiple name="type">
    <option selected value="1">type 1</option>
    <option selected value="2">type 2</option>
    <option selected value="3">type 3</option>
</select>

To find this reference was enough.

2540625
  • 11,022
  • 8
  • 52
  • 58
Pavel V.
  • 2,653
  • 10
  • 43
  • 74