当在移动设备上使用 select2 时,我遇到了问题。 单击后,将显示虚拟键盘。我尝试使用类似的东西
$('select').select2({
shouldFocusInput: function (instance) {
// Attempt to detect touch devices
var supportsTouchEvents = (('ontouchstart' in window) ||
(navigator.msMaxTouchPoints > 0));
// Only devices which support touch events should be special cased
if (!supportsTouchEvents) {
return true;
}
// Never focus the input if search is disabled
if (instance.opts.minimumResultsForSearch < 0) {
return false;
}
return true;
}
});
没有成功。即使我尝试简单地使用
shouldFocusInput: false
搜索文本不断获得焦点。
最佳答案
关于jquery - 移动设备上的 select2 键盘问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26803202/