在BootStrap的modal中使用Select2搜索框无法输入
用modal来show一个对话框
dialog.modal({
backdrop:true,
keyboard:true,
show:true
});
- 1
- 2
- 3
- 4
- 5
然后再modal中初始化select2
dialog.find("select").select2({
formatNoMatches: function() {
return "没有选项";
},
placeholder: "请选择...",
minimumResultsForSearch: 0,
allowClear: false
});
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
这时候select2的搜索框无法输入,一般有两方面的原因
1.检查下modal的div中是否有tabindex=”-1”,这个属性
<div class="modal fade in" id="dialog-new-draft">
- 1
2.js代码中加入
$.fn.modal.Constructor.prototype.enforceFocus = function () {};
- 1
满足这两个一般就没问题了。
在BootStrap的modal中使用Select2搜索框无法输入的更多相关文章
- Bootstrap3 模态框 select2搜索框无法输入
<div class="modal fade" role="dialog" aria-hidden="true" data-backd ...
- 在BootStrap的modal中使用Select2
bootstrap 3 $.fn.modal.Constructor.prototype.enforceFocus = function() {}; bootstrap4 $.fn.modal.C ...
- Bootstrap 模态框 select2搜索框无法输入
去掉模态框的div中的 tabindex="-1" 这个属性 <div class="modal fade" role="dialog" ...
- 解决select2在bootstrap的modal中默认不显示的问题
在Bootstrap中的Modal,select2插件会有不显示,因为其z-index小于modal,还有另外一个问题是,修正z-index之后,select2不会自动失去焦点的问题.代码解决如下: ...
- select2的搜索框不能输入搜索内容
按照select2官网配置完后,搜索框弹出后无法输入内容,究竟怎么回事,于是在其他页面尝试了select2,发现可以啊,为什么在这个地方不可以,终于找到了造成这个问题的不同之处:select2在模态对 ...
- select2搜索框查询加遍历
<div class="form-group"> <label class="control-label col-sm-1 no-padding-rig ...
- 解决 Ant Design Modal 中的 Select 选项框不能显示的问题
antd 的 select 在 modal 里不能显示候选框 代码示例 <a-modal> <a-select> <!-- options --> </a-s ...
- BootStrap 的modal 中使用typeahead
刚开始怎么也不现实,在页面上显示正常. 调试发现是下拉框被modal遮挡住了, 找到样式dropdown-menu 修改z-index值为2000后,显示正常.(modal的z-index值为1 ...
- bootstrap --- 在 modal中的 datetimepicker 关闭 ,会造成 modal也会被关闭.
这个大概是事件冒泡造成的. 解决办法: <form id="userForm" class="form-horizontal"> <input ...
随机推荐
- Java框架部分---面试题
说说Spring? Spring的核心是控制反转.依赖注入,Aop(面向切面)相当于把每个bean与bean之间的关系交给第 三方容器进行管理. 说SpringIOC.SpringAOP? Sprin ...
- python魔术方法(__init__,__call__,被双下划线包围的方法)
转载link:http://pycoders-weekly-chinese.readthedocs.io/en/latest/issue6/a-guide-to-pythons-magic-metho ...
- leetcode python 009
##懒得自己做 ## 验证回文数字int0=63435435print(int(str(int0)[::-1])==int)
- CodeForces - 589A (STL容器的使用)
Polycarp has quite recently learned about email aliases. Of course, he used to suspect that the case ...
- 0913_Python初识及变量
1.Python3不需加utf-8,Python必须加utf-82.单行注释用#,多行注释用""" """3.变量:只能由字母.数字.下划线 ...
- XML一
HTML(HyperText Markup Language),即超文本标记语言,是用于描述网页文档的一种描述标记语言. 而XML(E ...
- POJ1738 An old Stone Game
题意 Language:Default An old Stone Game Time Limit: 5000MS Memory Limit: 30000K Total Submissions: 439 ...
- docker lamp
可以直接使用官方镜像搭建LAMP环境从官方下载PHP+Apache镜像和MySQL两个镜像来组成(如:php:7.2.3-apache-stretch和mysql:5.7.21)docker pull ...
- 斐波那契数列中获取第n个数据值
class Fibonacci { /** * Description:迭代方法获取fibonacci第n项数值 * * @param int $n * @return int */ public s ...
- find查找文件的时间问题
很多细节方面的东西没有到真正用的时候,是觉察不出来的,因为这个时间的问题出了问题,现在好好理一下,这个find的时间很容易就搞混了,一段时间不用,也忘了,也反映出来了自己的基础知识不是很牢固啊 f ...