const modalTriggers = document.querySelectorAll(".modal-trigger");
modalTriggers.forEach((modalTrigger) => {
modalTrigger.addEventListener("click", (clickEvent) => {
const trigger = clickEvent.target;
const modalId = trigger.getAttribute("data-modal-id");
openModal(modalId);
});
});
<button class="modal-trigger bg-brandPrimary-500 rounded-full p-8 shadow-custom text-white" data-modal-id="openFilterDialog"><span><i data-feather="layers" ></i></span></button>
当我点击#span #i 时,它不会触发data-modal-id,但是当我点击#button 时,它会触发data-modal-id。如果我们单击按钮跨度或 I,触发 data-modal-id 的可能方法是什么?谁可以帮我这个事?