Bootstrap.js引发选择器选项错误:在 windows.document 对象上初始化工具提示时必须指定选择器选项
2022-09-02 12:41:59
当我尝试在引导中运行我的Web应用程序时.js我收到以下错误:
localhost:7904/Scripts/bootstrap 中第 7 列第 1306 行的未处理异常.js 0x800a139e - JavaScript 运行时错误:在 window.document 对象上初始化工具提示时必须指定选项!
selector
这是它所指的以下代码行:
Tooltip.prototype.init = function (type, element, options) {
this.enabled = true
this.type = type
this.$element = $(element)
this.options = this.getOptions(options)
this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))
this.inState = { click: false, hover: false, focus: false }
if (this.$element[0] instanceof document.constructor && !this.options.selector) {
//LINE 1306 IS RIGHT HERE
throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')
}
var triggers = this.options.trigger.split(' ')
for (var i = triggers.length; i--;) {
var trigger = triggers[i]
if (trigger == 'click') {
this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))
} else if (trigger != 'manual') {
var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'
var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'
this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))
this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))
}
}
this.options.selector ?
(this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
this.fixTitle()}
任何关于此事的帮助将不胜感激,谢谢。