简体   繁体   English

Bootstrap-Datetimepicker 不适用于 jQuery 3

[英]Bootstrap-Datetimepicker not working with the jQuery 3

Bootstrap-datetimepicker is not working with jQuery 3.1.1. Bootstrap-datetimepicker 不适用于 jQuery 3.1.1。 I need to use the same jQuery library to run all the other dependent functions.我需要使用相同的 jQuery 库来运行所有其他相关函数。

As per the docs, the required files for bootstrap datetimepicker to run are : 根据文档,要运行的bootstrap datetimepicker所需的文件是:

jQuery jQuery的

Moment.js Moment.js

Bootstrap.js Bootstrap.js

Bootstrap CSS Bootstrap CSS

Bootstrap Datepicker CSS Bootstrap Datepicker CSS

Locales: Moment's locale files 语言环境:Moment的语言环境文件

See this fiddle and check External Resources on the left 看到这个小提琴并查看左侧的外部资源

Initialize like this 像这样初始化

$('#datetimepicker1').datetimepicker();

I have used the following files : jQuery 3.1.1 我使用了以下文件:jQuery 3.1.1

moment.js moment.js

bootstrap.min.css bootstrap.min.css

bootstrap.min.js bootstrap.min.js

bootstrap-datetimepicker.min.css 自举datetimepicker.min.css

bootstrap-datetimepicker.min.js 引导-datetimepicker.min.js

Also, read this installation post in the documentation for better understanding. 另外,请阅读文档中的此安装文章以便更好地理解。

I am getting same error. 我得到了同样的错误。

input.size is not a function TypeError

modify bootstrap-datetimepicker.js line 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;    
 }
$('.datepicker-manual').datepicker({
 startDate: new Date(),
 format: 'dd/mm/yyyy', //you can change date format to any
 autoclose: true,
 todayHighlight: true,
 placeholder:new Date(),
 startDate: new Date(), //this will be today's date
 endDate: new Date(new Date().setDate(new Date().getDate() + 360))
});
$(document).on( "change", ".datepicker-manual", function() {
    $(this).datepicker('hide');
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM