Bootstrap DateTimePicker安装/配置 [英] Bootstrap datetimepicker installation/configuration
问题描述
我在 eonasdan引导程序datetimepicker 的基本配置上遇到了一些问题.
I'm having some issues with a basic configuration of the eonasdan bootstrap datetimepicker.
我使用他们
I created a fiddle using the code from their basic setup instructions to show my configuration. I see another Stackoverflow question on this topic that has another fiddle with older versions of the same plugins. The two fiddles look similar, but mine doesn't work.
<div class="container">
<div class="row">
<div class='col-sm-6'>
<div class="form-group">
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
$('#datetimepicker1').datetimepicker();
});
</script>
</div>
</div>
为什么我的提琴作品中没有日期时间选择器?
Why doesn't the datetime picker in my fiddle work?
推荐答案
如果在检查控制台时运行小提琴,则会看到以下错误:
If you run your fiddle while inspecting the console you will see the following error:
uncaught exception: bootstrap-datetimepicker requires Moment.js to be loaded first
因此,这仅仅是脚本加载顺序的问题. 此 是完全相同的提琴,只是最后载入了bootstrap-datetimepicker.min.js
,而且有效.
So it's simply a matter of the order in which the scripts are loaded. This is exactly the same fiddle, except bootstrap-datetimepicker.min.js
is loaded last, and it works.
只需按正确的顺序加载资源,或使用依赖项管理工具为您整理资源即可.
Just take care of loading the resources in the right order, or use a dependency management tool to sort it out for you.
这篇关于Bootstrap DateTimePicker安装/配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!