Where is Popper.js being loaded?
Jan 15, 2025
5
Level 4
Tooltips not showing in Laravel 11 with Bootstrap 5, PopperJs and jQuery - SASS
I am not getting any errors in JS console, but for whatever reason my Tooltips will not show.
In my app.js I have...
import './bootstrap';
import 'bootstrap';
import jQuery from 'jquery';
import Cookies from 'js-cookie';
window.jQuery = jQuery;
window.Cookies = Cookies;
My button...
<button class="btn btn-sm btn-warning float-end" data-bs-toggle="tooltip" data-bs-placement="top" title="Permissions">
<i class="fas fa-user-shield"></i>
</button>
Initialization of tooltip...
<script type="module">
document.addEventListener('DOMContentLoaded', function () {
const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
const tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new Tooltip(tooltipTriggerEl);
});
});
</script>
No errors in js console, when i hover i just get the basic title tooltip.
Bootstrap modals are working so i know bootrap is loaded, ajax is working so i know jquery is loaded, any ideas?
Thanks!
Level 80
@mfoote How are you including app.js in your view? Also, jQuery is not required for Bootstrap 5.
I personally just enable the tooltips in my app.js file since it’s loaded via Vite, so automatically deferred and initialised after the DOM has loaded:
import * as bootstrap from 'bootstrap';
window.bootstrap = bootstrap;
document.querySelectorAll('[data-bs-toggle="tooltip"]', (el) => new window.bootstrap.Tooltip(el));
Please or to participate in this conversation.