【问题标题】:twitter bootstrap 3 datepicker doesnt work when the calendar is clicked单击日历时,twitter bootstrap 3 datepicker不起作用
【发布时间】:2014-03-12 00:15:57
【问题描述】:

我正在使用这个仓库: https://github.com/eternicode/bootstrap-datepicker

我为日期选择器选择了我想要的功能并使用了所有正确的库。当我单击框查找图标以显示日历下拉列表时,没有任何反应。并且在使用 firefox 时,在 firebug 中不会报告任何错误。有人可以指出问题所在吗?

tahnks

顺便说一句,在日期选择器网站上,我选择了“组件”作为类型。所以当我指的是盒装图标时,你知道我在说什么。

代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>


<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
<link id="bsdp-css" href="http://eternicode.github.io/bootstrap-datepicker/css/datepicker3.css" rel="stylesheet">


<script src="http://eternicode.github.io/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>

</head>
<body>

<div class="input-group date" style="width:400px;">
<input type="text" class="form-control"><span class="input-group-addon"><i class="glyphicon glyphicon-th"></i></span>
</div>




<script type="text/javascript">
$(function(){
    $('#sandbox-container .input-group.date').datepicker({
    format: "mm/dd/yy",
    minViewMode: 1,
    autoclose: true,
    todayHighlight: true
});
});
</script>
</body>
</html>

【问题讨论】:

    标签: javascript jquery twitter-bootstrap datepicker


    【解决方案1】:

    选择器“#sandbox-container”是演示站点中带有“input-group date”类的DIV的父节点。 您需要在外面添加一个 DIV 标记。然后可以按下带有 glyphicon-th 类的 I 标记。 请参考http://jsbin.com/lerojivu/1/edit

    【讨论】:

      【解决方案2】:

      两个问题:

      1. datepicker js链接错误,应该是:http://eternicode.github.io/bootstrap-datepicker/bootstrap-datepicker/js/bootstrap-datepicker.js

      2. minViewMode: 1 可能错误

      检查:http://jsfiddle.net/yHQ4t/

      $(function(){$('#dateBox').datepicker({
          format: "mm/dd/yy",
          //minViewMode: 1,
          autoclose: true,
          todayHighlight: true
          });
      });
      

      【讨论】:

      • 谢谢,但是当我查看该 jsfiddle 并单击该图标时,什么也没有发生。我正在使用 Firefox 27.0.1 和 chrome 33.0.1750.149。我还得在另一台电脑上检查一下。
      猜你喜欢
      • 2015-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多