[英]Eonasdan datetimepicker doesn't work in inline mode
I have an issue: when I use datetimepicker in inline mode, console shows me this: 我有一个问题:在串联模式下使用datetimepicker时,控制台会向我显示以下内容:
Uncaught TypeError: Cannot read property 'dateFormat' of null
未捕获的TypeError:无法读取null的属性'dateFormat'
<div style="overflow:hidden;">
<div class="form-group">
<div class="row">
<div class="col-md-8">
<div id="datetimepicker12"></div>
</div>
</div>
</div>
$(function () {
$('#datetimepicker12').datetimepicker({
inline: true,
sideBySide: true
});
});
Here is my fiddle: https://jsfiddle.net/maxdonetsk/jahsjkkn/ 这是我的小提琴: https : //jsfiddle.net/maxdonetsk/jahsjkkn/
Can you help me? 你能帮助我吗? Thanks in advance.
提前致谢。
Just change your datetimepicker js to 只需将您的datetimepicker js更改为
https://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/e8bddc60e73c1ec2475f827be36e1957af72e2ea/src/js/bootstrap-datetimepicker.js
and your code will work 并且您的代码将正常工作
here is the fiddle : https://jsfiddle.net/shoaibakhter/w0nk1c5z/ 这是小提琴: https : //jsfiddle.net/shoaibakhter/w0nk1c5z/
You forgot some HTML :-) 您忘记了一些HTML :-)
This is what I have changed: 这是我更改的内容:
<div id="datetimepicker12"></div>
to 至
<div class='input-group date' id='datetimepicker12'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
Here is an updated fiddle: https://jsfiddle.net/273tzgnz/1/ 这是更新的小提琴: https : //jsfiddle.net/273tzgnz/1/
To clarify: this has nothing to do with inline-mode. 需要说明的是:这与内联模式无关。 This has to do with the fact that you didn't have an input for the datetimepicker to bind to.
这与以下事实有关:您没有输入要绑定的datetimepicker。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.