Complete the code to add a tooltip to the button using Bootstrap.
<button type="button" class="btn btn-secondary" data-bs-toggle="[1]" title="Tooltip text">Hover me</button>
The attribute data-bs-toggle="tooltip" activates the tooltip on the button.
Complete the JavaScript code to enable all tooltips on the page.
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); const tooltipList = tooltipTriggerList.map(function ([1]) { return new bootstrap.Tooltip([1]); });
The variable element represents each DOM element with the tooltip attribute.
Fix the error in the tooltip initialization code by completing the missing option.
var tooltipTrigger = document.getElementById('myTooltip'); var tooltip = new bootstrap.Tooltip(tooltipTrigger, { placement: '[1]' });
The placement option accepts values like top, bottom, left, or right. top places the tooltip above the element.
Fill both blanks to create a button with a tooltip that appears on the right side and has the text 'Info'.
<button type="button" class="btn btn-info" data-bs-toggle="[1]" data-bs-placement="[2]" title="Info">Hover me</button>
The button uses data-bs-toggle="tooltip" to activate the tooltip and data-bs-placement="right" to position it on the right side.
Fill all three blanks to create a tooltip that triggers on focus, has a delay of 500ms, and uses the dark theme.
var tooltipTrigger = document.getElementById('focusTooltip'); var tooltip = new bootstrap.Tooltip(tooltipTrigger, { trigger: '[1]', delay: [2], customClass: '[3]' });
The tooltip triggers on focus, has a delay of 500 milliseconds, and uses the dark theme via customClass.