While working on a page in Chrome, I encountered an issue where I wanted a modal to show up when a user clicked on an image. However, the functionality was not working as expected on my localhost. Upon further inspection, I believe there might be a problem with a listener in my code. Here's what I have:
$(document).ready(function() {
document.getElementByClass(".call-to-action").addEventListener("click", openModal());
});
function openModal() {
$("html").addClass("modal-open");
}
This is how my CSS looks like:
.modal-open
.modal
opacity: 1
pointer-events: all
Any insights or suggestions would be greatly appreciated!