【发布时间】:2015-09-15 13:40:09
【问题描述】:
如何先设置占位符而不是 Select2 中的默认值
我这里有这段 HTML 代码:
<select class = "select2" style = "width:100%" id = "selectme">
<option value = "oldest"> Person 1</option>
<option value = "oldest"> Person 2</option>
<option value = "oldest"> Person 3</option>
</select>
这里是 Select2 的 Jquery:
$("#selectme").select2({
placeholder: "Assign to:",
allowClear:true
});
Select2 Documentation 中的示例首先将占位符设置为默认值。但在我的情况下,默认值为 Person 1 而不是占位符。为什么?
【问题讨论】:
标签: javascript jquery html jquery-select2