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.
Asked
Active
Viewed 2.9k times
11
-
jQuery ***3.3.1***? :O :O – philantrovert Dec 20 '16 at 07:07
-
1@philantrovert he's from the future :)) – madalinivascu Dec 20 '16 at 07:08
-
1@Karan Batra please wait until jquery reaches v 3.3.1 and we will help you then :)) – madalinivascu Dec 20 '16 at 07:09
-
Please file your issue here: https://github.com/Eonasdan/bootstrap-datetimepicker/issues – Benny Code Dec 20 '16 at 07:11
-
@KaranBatra Are you using moment.js? – philantrovert Dec 20 '16 at 07:12
-
yes, I am using moment.js. – Karan Batra Dec 20 '16 at 07:15
-
what is bootstrap version u have been using – user1844933 Dec 20 '16 at 07:27
3 Answers
13
I am getting same error.
input.size is not a function TypeError
modify bootstrap-datetimepicker.js line no: 2253
if (input.size() === {
to
if (input.length === 0) {
line no:2264
if (element.find('.datepickerbutton').size() === 0) {
to
if (element.find('.datepickerbutton').length === 0) {
add css
.input-group.date .dropdown-menu{
display: block;
}

kelvin kantaria
- 1,438
- 11
- 15
-
This worked until I updated Bootstrap. If they haven't fixed it yet, there must be some other workaround. – BWhite Sep 12 '19 at 18:26
11
As per the docs, the required files for bootstrap datetimepicker to run are :
jQuery
Moment.js
Bootstrap.js
Bootstrap CSS
Bootstrap Datepicker CSS
Locales: Moment's locale files
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
bootstrap-datetimepicker.min.css
bootstrap-datetimepicker.min.js
Also, read this installation post in the documentation for better understanding.

Community
- 1
- 1

philantrovert
- 9,904
- 3
- 37
- 61
-
2
-
I am using same jQuery 3.1.1 but it does not working . My files order are : jquery-3.1.1.js moment.js bootstrap.3.3.7.min.js moment-with-locales.js jquery-migrate-1.4.1.js bootstrap-datetimepicker.js – Muhammad Bilal Jan 06 '17 at 05:32
-
@philantrovert thanks for getting back. It seems working fine. i was using `bootstrap-datetimepicker.js` rather then `bootstrap-datetimepicker.min.js` but it works with `bootstrap-datetimepicker.min.js`. I would like to update approved answer. The order is must only for `Javascript` files. I have added CSS separately and everything is working fine for me. Once again thanks for your positive answer. – Muhammad Bilal Jan 06 '17 at 06:39
-
1@Muhammad that's strange. A `min` is essentially a minified version of the same javascript file. Great that you got it worked out though. – philantrovert Jan 06 '17 at 06:41
-
5`bootstrap-datetimepicker.js` is not compatible with `jquery.3.1.1` due to this exception: `jQuery.Deferred exception: input.size is not a function TypeError: input.size is not a function` – Muhammad Bilal Jan 06 '17 at 07:06
-
-
@LudovicKuty Looks like your suggestion of updating jquery may have solved it. Kind of hidden here at the end and I didn't even see it until the fifth time reading through. – BWhite Sep 12 '19 at 21:02
0
$('.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');
});
-
100% working for me... change event is import to auto hide... – RajiGates RajeshKumar Sep 03 '22 at 00:26