javascript - Bootstrap.js 抛出选择器选项错误 : selector option must be specified when initializing tooltip on the windows. 文档对象

标签 javascript java jquery css twitter-bootstrap

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

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!

这是它引用的以下代码行:

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

如有任何帮助,我们将不胜感激,谢谢。

最佳答案

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

<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 放在后面。这似乎解决了这个问题。

关于javascript - Bootstrap.js 抛出选择器选项错误 : selector option must be specified when initializing tooltip on the windows. 文档对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37840492/

相关文章:

javascript - 压缩 Jquery 更干净

javascript - jQuery UI 对话框未第二次打开,但背景无法访问

javascript - 不是具有异步功能的构造函数

javascript - onbeforeunload - 用户接受确认框后,javascript 不执行

java - Object[] 是如何克隆的

java - 正则表达式问题。如何删除字符串中最后一个 "<br>"

javascript - 如何使用 For 循环将选项 html 参数放在单独的父 div 中

javascript - 如何将 JS 数组转换为 VB 脚本数组(二维数组)

javascript - 单击 Enter 时提交文本区域

java - KD树——最近邻算法