Bootstrap 5.3 modal issues
-
Hi, first of all thanks for this great plugin.
I had some issues with the modal block and bootstrap 5.3, I assume 5.x is still in beta and not everything is implemented / documented yet with Plugin Version 1.3.13.
Apparently the modal won’t show with the anchor / href method.
This is just a heads up for the developers or user who want to use it and struggle to get it working 😀
My workaround solution is some JavaScript, which adds the necessary attributes to all trigger elements. Simply follow the modal tutorial but ensure your link starts with “#modal” and the anchor obviously with “modal”
const triggers = document.querySelectorAll('button[href],a[href]'); for (const trigger of triggers) { const href = trigger.getAttribute('href'); if (!href.startsWith('#modal')) { continue; } trigger.setAttribute('data-bs-toggle', 'modal'); trigger.setAttribute('data-bs-target', href); }
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Bootstrap 5.3 modal issues’ is closed to new replies.