美好的一天,我如何通过 jquery 或 javascript 正确关闭 select2 下拉菜单?
现在我正在使用select2-dropdown.toggle()
关闭它,
but I noticed that It will simply hide the list and the select2 box is still being highlighted
I want to lost focus it or something like that just to close it properly and be able to come up with a result like this one .
顺便说一句,屏幕截图是黑色的,因为这些 select2 框位于引导模式下,每当我按 Enter 键时就会出现该模式。
任何建议将不胜感激!提前致谢
我知道这是一个老问题,但为了使用 API 执行此操作,您只需执行以下操作:
选择2 API
$("#select2-drop-mask").select2("close");
这个问题还提到了引导模式对话框,这往往是人们想要以编程方式关闭它的原因。
对于任何人的信息,这就是你这样做的方法:
引导程序3
$('#myModal').on('hidden.bs.modal', function () {
$('#select2-drop-mask').select2("close");
})
引导程序2
$('#myModal').on('hidden', function () {
$('#select2-drop-mask').select2("close");
})
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)