通过javascript/jquery关闭select2下拉列表 [英] close select2 dropdown via javascript/jquery
问题描述
早上好,如何通过jquery或javascript正确关闭select2下拉列表?
Good day, How can I properly close a select2 dropdown via jquery or javascript??
现在我使用select2-dropdown.toggle()
将其关闭,
但是我注意到它只会隐藏列表,并且select2框仍会突出显示
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键时,该模式就会出现.
by the way the screen shots are dark because those select2 boxes are under a bootstrap modal that would come up whenever I press enter.
任何建议都将不胜感激!预先感谢
Any advice would really be appreciated! Thanks in advance
推荐答案
这个对我有用$("#select2-drop-mask").click();
这篇关于通过javascript/jquery关闭select2下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!