bootstrap模态框和select2合用时input无法获取焦点
来源:互联网 发布:90后网络行为分析 编辑:程序博客网 时间:2024/05/21 22:42
参考文献:http://blog.csdn.net/fireofjava/article/details/48414207http://www.voidcn.com/blog/ynwso/article/p-296035.html
当bootstrap 模态框和select2配合使用的时候或出现 input 无法获取焦点的问题
产生的原因:
Bootstrap registers a listener to the focusin event which checks whether the focused element is either the overlay itself or a descendent of it - if not it just refocuses on the overlay. With the select2 dropdown being attached to the body this effectively prevents you from entering anything into the the textfield.You can quickfix this by overwriting the enforceFocus function which registers the event on the modal
解决办法:
我这次解决的办法就是把tabindex="-1"去掉就可以了
其他的解决办法:
<script>$(document).ready(function() { $("#select2insidemodal").select2({ dropdownParent: "#myModal" });});</script>
0 0
- bootstrap模态框和select2合用时input无法获取焦点
- bootstrap模态框modal和select2合用时input无法获取焦点
- bootstrap 的模态框无法获取焦点
- select2搜索框无法输入 Bootstrap 模态框
- bootstrap 的模态框 内部组件无法获取焦点
- bootstrap-modal:弹出modal时input的checked的状态无法改变 | | input获取焦点不生效
- bootstrap select2插件用ajax来获取和显示数据
- input文本框获取焦点和失去焦点判断
- bootstrap弹出的modal中表单控件无法获取焦点
- 移动端input 无法获取焦点的问题
- input js获取焦点
- jquery ui dialog 中使用select2 导致select2的input失去焦点的解决方法
- input输入框获取焦点、获取焦点位置、焦点设置
- input文本框获取/失去焦点
- angularJs如何获取input焦点
- css input文本框获取焦点
- EditText无法获取焦点
- Button无法获取焦点
- 大数据实战下笔记——Hadoop NameNode HA的原理
- java使用POI实现excel文件的读取,兼容后缀名xls和xlsx
- UVA - 11389 The Bus Driver Problem
- 【挖坑记】 JZOJ 4724 斐波那契
- Android - local storage & UserTable sample
- bootstrap模态框和select2合用时input无法获取焦点
- Android - Pass value through SharedPreferences
- php中的trait
- iOS进度提示组件 MBProgressHUD、SVProgressHUD
- PPTP协议
- ubuntu16.04主题美化和软件推荐
- NDK学习:C与C++在Ndk中的区别
- new scanner(system.in)超时问题
- Android - processing & processed message