dotnet/AspNetCore.Docs · error · Error
Popover requires tooltip.js
Error message
Popover requires tooltip.js
What it means
Identical guard to error 1 in the 3.x sample: popover.js asserts `$.fn.tooltip` exists at load time because Popover extends Tooltip. Missing tooltip.js or wrong order triggers the throw.
Source
Thrown at aspnetcore/mvc/controllers/testing/samples/3.x/TestingControllersSample/src/TestingControllersSample/wwwroot/js/bootstrap.js:1797
* Bootstrap: popover.js v3.3.7
* http://getbootstrap.com/javascript/#popovers
* ========================================================================
* Copyright 2011-2016 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* ======================================================================== */
+function ($) {
'use strict';
// POPOVER PUBLIC CLASS DEFINITION
// ===============================
var Popover = function (element, options) {
this.init('popover', element, options)
}
if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')
Popover.VERSION = '3.3.7'
Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
placement: 'right',
trigger: 'click',
content: '',
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
})
// NOTE: POPOVER EXTENDS tooltip.js
// ================================
Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)
Popover.prototype.constructor = Popover
View on GitHub (pinned to c67a80103a)
Solutions
- Include tooltip.js before popover.js, or use the full bootstrap.js bundle.
- Ensure the tooltip module is present in any custom build that includes popover.
Example fix
// before <script src="popover.js"></script> <script src="tooltip.js"></script> // after <script src="tooltip.js"></script> <script src="popover.js"></script>
Defensive patterns
Strategy: validation
Validate before calling
if (typeof jQuery === 'undefined' || !jQuery.fn || !jQuery.fn.tooltip) {
console.error('tooltip.js missing; Popover unavailable');
} else {
$('#el').popover();
} Type guard
function bootstrapTooltipAvailable() { return typeof jQuery !== 'undefined' && !!jQuery.fn && typeof jQuery.fn.tooltip === 'function'; } Try / catch
try {
$('#el').popover();
} catch (e) {
if (/Popover requires tooltip\.js/.test(e.message)) {
console.error('Include tooltip.js before popover.js');
} else { throw e; }
} Prevention
- Use the full bootstrap.js bundle to guarantee plugin order.
- Keep script includes in a single layout with a fixed order.
- CI-check that tooltip.js precedes popover.js in the bundle.
When it happens
Trigger: Loading popover.js without/after tooltip.js in the 3.x sample; custom Bootstrap build omitting the tooltip module.
Common situations: Script-tag ordering in the 3.x layout; bundler reordering; minimal Bootstrap download.
Related errors
- Popover requires tooltip.js
- Popover requires tooltip.js
- Bootstrap's JavaScript requires jQuery
- ${this.type} `template` option must consist of exactly 1 top
- `selector` option must be specified when initializing ${this
AI-assisted analysis of dotnet/AspNetCore.Docs@c67a80103a (2026-08-13).
Data as JSON: /api/errors/e235bbe6f74aabcd.
Report an issue: GitHub.