How to set "all values" as default in a multiple select?

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?


http://jsfiddle.net/UgHT5/这是你的需要吗?

<select multiple>
    <option selected>a</option>
    <option selected>b</option>
    <option selected>c</option>
</select>

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.

链接地址: http://www.djcxy.com/p/88086.html

上一篇: PHP在编辑的表单上的下拉列表中选择更新内容

下一篇: 如何在多重选择中将“所有值”设置为默认值?