Bootstrap Datepicker似乎不起作用 [英] Bootstrap Datepicker seems to not work
本文介绍了Bootstrap Datepicker似乎不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在日期选择器方面遇到问题.也搜索一些答案,但似乎无济于事,这是我的代码:
I'm having a problem with date picker. Search some answers too but doesn't seem to help, here's my code:
<link rel="stylesheet" type="text/css" href="../css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="../datepicker/css/datepicker.css" />
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" placeholder="Date"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../datepicker/js/bootstrap-datepicker.js"></script>
<script type="text/javascript">
$(function () {
$('#datetimepicker1').datepicker();
});
</script>
推荐答案
请将jQuery
选择器更改为$('**.input-group.date**').datepicker()
;
DIV是启动日期选择器所必需的. 请参考 http://jsbin.com/lerojivu/1/edit
The DIV is necesaary for datepicker to be initiated. Please refer to http://jsbin.com/lerojivu/1/edit
源代码中的变体zIndex
place: function ()...
由于使用模态z-index属性为零. 可以对下面列出的内容进行修改.
Due to using the modal z-index property is zero. It can be amended listed below.
var parentZIndexes = this.element.parents().map(function() {
return parseInt($(this).css('z-index')) || 0;
});
var zIndex = Math.max.apply(Math, Array.prototype.slice.apply(parentZIndexes)) + 10;
这篇关于Bootstrap Datepicker似乎不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文