Skip to content

Commit e1f5fbb

Browse files
committed
add support for NO CONFLICT and DATA-API
1 parent dd6dc89 commit e1f5fbb

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

js/bootstrap-datepicker.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@
801801
}
802802
};
803803

804+
var old = $.fn.datepicker;
804805
$.fn.datepicker = function ( option ) {
805806
var args = Array.apply(null, arguments);
806807
args.shift();
@@ -1015,4 +1016,23 @@
10151016

10161017
$.fn.datepicker.DPGlobal = DPGlobal;
10171018

1019+
/* DATEPICKER NO CONFLICT
1020+
* =================== */
1021+
1022+
$.fn.datepicker.noConflict = function () {
1023+
$.fn.datepicker = old;
1024+
return this;
1025+
}
1026+
1027+
1028+
/* DATEPICKER DATA-API
1029+
* ================== */
1030+
1031+
$(document).on('focus.datepicker.data-api', '[data-provide="datepicker"]', function (e) {
1032+
var $this = $(this);
1033+
if ($this.data('datepicker')) return;
1034+
e.preventDefault();
1035+
$this.datepicker($this.data());
1036+
})
1037+
10181038
}( window.jQuery );

0 commit comments

Comments
 (0)