我使用过bootstrap select js。以下是用于选择的代码:
<select data-required="true" name="option" class="selectpicker" multiple >
<option value="" disabled selected>Pick the once that apply to u</option>
<option value="1">Shipping / post</option>
<option value="2">Customers can collect</option>
<option value="3">Other</option>
</select>
如果我在第一个选项中不加上
selected
,则将不进行验证,但如果我添加,则第一个选项将自动选择。请给我一些关于以下两点的解决方案:
- 验证
- 第一个选项不应自动选择