How to pass html tags as content of glightbox

96 Views Asked by At
const tmSingleElements = document.querySelectorAll('.tm-single');

if (tmSingleElements.length > 0) {
  tmSingleElements.forEach((tmSingle) => {
    tmSingle.addEventListener('click', function () {
      const teamMemberPopup = tmSingle.querySelector('.team-member-popup');

      if (teamMemberPopup) {
        const contentContainer = document.createElement('div');
        contentContainer.innerHTML = teamMemberPopup.innerHTML;
        const lightBox = GLightbox({
          elements: [
            {
              source: teamMemberPopup.innerHTML,
              type:'inline'
            },
          ],
        });
        lightBox.open();
        console.log(teamMemberPopup.innerHTML)
      }
    });
  });
}

I need to open relavant .team-member-popup htmls inside the glight box when click the .tm-single. but it opens a empty glight box without contents. how to solve this issue

0

There are 0 best solutions below