我使用的是select2 v4,当用户从下拉列表中选择一个选项时,我试图显示一个confirm()。
所以我有事件.on("select2:select", function(e) {}),如果用户从确认对话框中选择取消,我希望阻止select2。
我有以下几点:
$("#select2users").select2().on("select2:select", function(e) {
var data = e.params.data;
if(!confirm("Are you sure y
我使用select2将远程数据加载到html选择中
问题是,如果用户选择一个选项,->将清除服务器->中的输入->数据更改,用户再次搜索数据。如果我要求选择数据,它会返回旧的(以前选择的)值。
示例:
//User search for an option and selects it
$('#someSelect').select2('data').Limit
//Here the limit is 0
//Server data changes on server. Now limit is 10
//User searchs ag
我正在为生日创建一个选择选项,其中包括目前用于测试目的的月份和日期。一切都很好,但问题是,例如,当我选择一月时,它将给出最多31天的时间,但如果我仍然选择31天,而当我选择Febraury时,它会添加带有新数组的前一个数组,即1月的31天+ Febraury 28天。请帮助我如何清除之前的数组,然后添加一个新的。
这是Javascript:
function change(){
var s1 = document.getElementById('select1');
var s2 = document.getElementById('select