Bootstrap-Datetimepicker 不适用于 jQuery 3
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41236574/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap-Datetimepicker not working with the jQuery 3
提问by Karan Batra
Bootstrap-datetimepicker is not working with jQuery 3.1.1. I need to use the same jQuery library to run all the other dependent functions.
Bootstrap-datetimepicker 不适用于 jQuery 3.1.1。我需要使用相同的 jQuery 库来运行所有其他依赖函数。
回答by kelvin kantaria
I am getting same error.
我收到同样的错误。
input.size is not a function TypeError
modify bootstrap-datetimepicker.jsline no: 2253
修改bootstrap-datetimepicker.js行号:2253
if (input.size() === {
to
到
if (input.length === 0) {
line no:2264
行号:2264
if (element.find('.datepickerbutton').size() === 0) {
to
到
if (element.find('.datepickerbutton').length === 0) {
add css
添加css
.input-group.date .dropdown-menu{
display: block;
}
回答by philantrovert
As per the docs, the required files for bootstrap datetimepicker to run are :
根据文档,引导程序 datetimepicker 运行所需的文件是:
jQuery
Moment.js
Bootstrap.js
Bootstrap CSS
Bootstrap Datepicker CSS
Locales: Moment's locale files
jQuery
时刻.js
Bootstrap.js
引导 CSS
Bootstrap 日期选择器 CSS
语言环境:Moment 的语言环境文件
See this fiddleand check External Resourceson the left
看到这个小提琴并检查左侧的外部资源
Initialize like this
像这样初始化
$('#datetimepicker1').datetimepicker();
I have used the following files : jQuery 3.1.1
我使用了以下文件:jQuery 3.1.1
bootstrap-datetimepicker.min.css
bootstrap-datetimepicker.min.css
bootstrap-datetimepicker.min.js
bootstrap-datetimepicker.min.js
Also, read this installationpost in the documentation for better understanding.
另外,请阅读文档中的此安装帖子以更好地理解。