我想覆盖https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/js/bootstrap-datepicker.js中的一部分。我想将javascript文件中的mousedown touchstart更改为mousedown。我无法更改已下载的bootstrap.datepicker.js文件,而应通过重写在JavaScript文件中覆盖它。我不知道如何更改数组中的内容。
我不知道如何覆盖这些类型的功能。
[$(document), {
'mousedown touchstart': $.proxy(function(e) {
// Clicked outside the datepicker, hide it
if (!(
this.element.is(e.target) ||
this.element.find(e.target).length ||
this.picker.is(e.target) ||
this.picker.find(e.target).length ||
this.isInline
)) {
this.hide();
}
}, this)
}]
我想将我的js文件更改为
[$(document), {
'mousedown': $.proxy(function(e) {
// Clicked outside the datepicker, hide it
if (!(
this.element.is(e.target) ||
this.element.find(e.target).length ||
this.picker.is(e.target) ||
this.picker.find(e.target).length ||
this.isInline
)) {
this.hide();
}
}, this)
}]