twbs/bootstrap · error · TypeError
No method named "${config}"
Error message
No method named "${config}" What it means
Tooltip's jQueryInterface dispatches $('#tip').tooltip(name) to the instance method name and throws when data[name] is undefined (simple undefined check, no '_' filtering). Public methods are show, hide, toggle, enable, disable, toggleEnabled, update, setContent and dispose — the same surface Popover inherits.
Source
Thrown at js/src/tooltip.js:619
}
if (this.tip) {
this.tip.remove()
this.tip = null
}
}
// Static
static jQueryInterface(config) {
return this.each(function () {
const data = Tooltip.getOrCreateInstance(this, config)
if (typeof config !== 'string') {
return
}
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config]()
})
}
}
/**
* jQuery
*/
defineJQueryPlugin(Tooltip)
export default Tooltip
View on GitHub (pinned to 6177d5f849)
Solutions
- Use the public methods: show, hide, toggle, enable, disable, toggleEnabled, update, setContent, dispose.
- Replace 'destroy' with 'dispose' and 'open'/'close' with 'show'/'hide'.
- Use setContent({ '.tooltip-inner': '...' }) for dynamic content.
- For dynamic names, check typeof bootstrap.Tooltip.getInstance(el)?.[name] === 'function' first.
Example fix
// before
$('#tip').tooltip('open') // TypeError: No method named "open"
// after
$('#tip').tooltip('show') // show|hide|toggle|enable|disable|toggleEnabled|update|setContent|dispose Defensive patterns
Strategy: validation
Validate before calling
function callTooltipMethod(element, method, ...args) {
const instance = bootstrap.Tooltip.getOrCreateInstance(element)
if (typeof instance[method] !== 'function') {
console.warn(`Tooltip: ignoring unknown method "${method}"`)
return
}
instance[method](...args)
} Type guard
const TOOLTIP_METHODS = ['show', 'hide', 'toggle', 'enable', 'disable', 'toggleEnabled', 'update', 'setContent', 'dispose'] as const type TooltipMethod = (typeof TOOLTIP_METHODS)[number] const isTooltipMethod = (m: string): m is TooltipMethod => (TOOLTIP_METHODS as readonly string[]).includes(m)
Try / catch
try {
$('#tip').tooltip(method)
} catch (err) {
if (err instanceof TypeError && err.message.startsWith('No method named')) {
console.warn(`Tooltip: unknown method "${method}"`)
} else {
throw err
}
} Prevention
- Translate old vocabulary: open/close→show/hide, destroy→dispose.
- Use setContent for dynamic content; update only repositions.
- Whitelist dynamic names against the nine public methods.
- Prefer the vanilla API for dynamic dispatch.
When it happens
Trigger: $('#tip').tooltip('open') or 'close' (correct: show/hide); $('#tip').tooltip('destroy') — v4 name, v5 is dispose; $('#tip').tooltip('updateContent') — the 5.2 API is setContent; $('#tip').tooltip('position').
Common situations: Porting jQuery UI or v4 Bootstrap code; tutorials predating the 5.2 setContent API; guessing verbs for positioning ('position', 'place') where update is the reposition call.
Related errors
- No method named "${config}"
- No method named "${config}"
- No method named "${config}"
- No method named "${config}"
- No method named "${config}"
AI-assisted analysis of twbs/bootstrap@6177d5f849 (2026-08-22).
Data as JSON: /api/errors/774ec3f2759c3fcf.
Report an issue: GitHub.