Bootstrap.js抛出一个选择器选项错误:在windows.document对象上初始化工具提示时必须指定selector选项 [英] Bootstrap.js throws a selector option error: selector option must be specified when initializing tooltip on the windows.document object

查看:270
本文介绍了Bootstrap.js抛出一个选择器选项错误:在windows.document对象上初始化工具提示时必须指定selector选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试在bootstrap.js中运行我的Web应用程序时,我收到以下错误:

When I try run my web application in bootstrap.js I get the following error:


第130行第7行的未处理异常in localhost:7904 / Scripts / bootstrap.js
0x800a139e - JavaScript运行时错误:选择器选项必须在window.document对象上初始化工具提示时指定!

Unhandled exception at line 1306, column 7 in localhost:7904/Scripts/bootstrap.js 0x800a139e - JavaScript runtime error: selector option must be specified when initializing tooltip on the window.document object!

这是它所指的以下代码行:

This is the following lines of code it is referring to:

  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()}

任何关于此事的帮助都将不胜感激,谢谢。

Any help on this matter would be appreciated, thanks.

推荐答案

我按以下方式重新排序库:

I re-ordered the libraries in the following way:

<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js" integrity="sha256-xNjb53/rY+WmG+4L6tTl9m6PpqknWZvRt0rO1SRnJzw=" crossorigin="anonymous"></script>

接下来我将所有个人javascripts放在后面。这似乎解决了这个问题。

Next I put all personal javascripts after. That seemed to take care of the issue.

这篇关于Bootstrap.js抛出一个选择器选项错误:在windows.document对象上初始化工具提示时必须指定selector选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆