我正在尝试使用bootstrap日期时间选择器。 我包括所有最低要求: CSS:
<link rel="stylesheet" type="text/css" href="bundles/app/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.min.css">
JS:
<script src="http://code.jquery.com/jquery-2.1.4.js"></script>
<script src="http://momentjs.com/downloads/moment.js"></script>
<script src="bundles/app/js/bootstrap.js"></script>
<script src="https://raw.githubusercontent.com/moment/moment/master/locale/it.js"></script>
<script src="bundles/app/console/js/bootstrap-datetimepicker.js"></script>
<script src="http://accounts.tao.tw.shuttle.com/assets/js/bootstrap-collapse.js"></script>
<script src="https://raw.githubusercontent.com/twbs/bootstrap/master/js/transition.js"></script>
然后我添加html:
<div class="container">
<div class="row">
<div class='col-sm-6'>
<input type='text' class="form-control" id='datetimepicker4' />
</div>
<script type="text/javascript">
$(function () {
$('#datetimepicker4').datetimepicker();
});
</script>
</div>
但是,如果我点击输入文字没有任何反应,日期时间选择器不起作用。 我确信所有的CSS和js文件都是成功加载的。 有人知道日期时间选择器如何工作? 感谢。
答案 0 :(得分:0)
问题在于你的导入,请改用它:
<html>
<head>
<script type="text/javascript" src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"></script>
<script src="//cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/src/js/bootstrap-datetimepicker.js"></script>
<link href="//cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/build/css/bootstrap-datetimepicker.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" media="screen" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" />
</head>
<body>
<div class="container">
<div class="row">
<div class='col-sm-6'>
<input type='text' class="form-control" id='datetimepicker4' />
</div>
<script type="text/javascript">
$(function () {
$('#datetimepicker4').datetimepicker();
});
</script>
</div>
</body>
</html>
&#13;