【发布时间】:2017-08-14 12:56:25
【问题描述】:
我正在处理通过 ajax 提交表单后必须清除 select2 下拉框的要求。我已经搜索并尝试了一些解决方案,但没有奏效。
我的 select2 代码是:
$(document).ready(function(){
$("#my_select_id").select2({
placeholder: "Select One Option",
allowClear: true,
initSelection: function(element, callback) { }
});
})
清除 select2 的脚本是:
$('#my_select_id').select2("val", "");
谁能告诉我这段代码有什么问题,谢谢。
【问题讨论】:
标签: jquery jquery-select2