Creating a sleek gallery using bootstrap 5, and curious about how to activate a bootstrap modal without including "data-bs-..." in the HTML (to prevent repeating those data- attributes multiple times).
I have successfully written a functioning JavaScript for the sources, but the .modal() and .show() functions do not seem to be working. Here's my code:
function gallery(_src) {
var fullPath = _src;
var fileName = fullPath.replace(/^.*[\\\/]/, '');
var newSrc = "./assets/img/" + fileName;
document.querySelector("div#galleryModal img").src = "./assets/img/" + fileName;
document.getElementById("galleryModal").show(); }
I am stuck on this final line of JavaScript. The goal is to activate #galleryModal.
Thank you for reading, and thank you for your assistance!