我正在使用Select2来增强我的<select>
输入。<options>
我用coldfusion和sql填充。formatNoMatches
如果用户搜索中没有匹配项,我想使用添加选项。我不想使用多项选择,因为它不适用于我的coldfusion,而且只需将点击事件添加到formatNoMatches
.
在 select2.js 中的某个地方,有一些代码可以阻止鼠标事件的发生formatNoMatches
。有没有办法破解它允许鼠标事件?
$(".select").select2({
allowClear: true,
blurOnChange: true,
openOnEnter: false,
formatNoMatches: function(term) {
return "<a href='#' onclick='alert('" + term + "');'"
+ "id='newClient'>Add New Client</a>";
}
});
我无法得到上面的代码来提醒任何事情。