'How to use Lightbox on AJAX loaded content
I am using Boostrap 5 and this Lightbox library https://trvswgnr.github.io/bs5-lightbox/
It works fine on pages loaded normally but it will not load on AJAX loaded content.
I have tried this code to make it work with AJAX but it did not work.
$(document).on('click', '[data-toggle="lightbox"]', function(event) {
event.preventDefault();
$(this).Lightbox();
});
It returned this error:
Uncaught TypeError: $(...).Lightbox is not a function
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
