20

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

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.

Angel Cloudwalker
  • 2,015
  • 5
  • 32
  • 54
  • Follow the stack trace of the error until you get to code that you have personally written – Sylvan D Ash Jun 15 '16 at 16:12
  • bootstrap.js:1306 Uncaught Error: `selector` option must be specified when initializing tooltip on the window.document object!Tooltip.init @ bootstrap.js:1306Tooltip @ bootstrap.js:1274(anonymous function) @ bootstrap.js:1743each @ jquery-2.2.0.js:360each @ jquery-2.2.0.js:137Plugin @ bootstrap.js:1737(anonymous function) @ ?AspxAutoDetectCookieSupport=1:71fire @ jquery-2.2.0.js:3182fireWith @ jquery-2.2.0.js:3312ready @ jquery-2.2.0.js:3531completed @ jquery-2.2.0.js:3547 – Angel Cloudwalker Jun 15 '16 at 16:20

1 Answers1

30

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>

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

Angel Cloudwalker
  • 2,015
  • 5
  • 32
  • 54
  • this works ! ... , even if i have different jquerys versions or customs js version , why is this so ? – diego matos - keke Aug 23 '16 at 23:43
  • I guess the dependencies are such that if they are not in this order it will throw an error, it's kind of hard to predict sometimes since the libraries are vast. I'm glad it helped though! – Angel Cloudwalker Aug 25 '16 at 15:52
  • But there is a second problem after that https://stackoverflow.com/questions/30190437/uncaught-error-cannot-call-methods-on-button-prior-to-initialization-attempted – VGranin Mar 26 '18 at 18:25