Skip to content Skip to sidebar Skip to footer

Onclick Of Button From Paginated Load Not Triggering

I have a procedural feed within my website which loads in data every time the user scrolls to the bottom of the page; the usual stuff. The pagination itself works fine; however, th

Solution 1:

One way you can do this is to remove e.stopPropogation and also target the children

var modalTrigger = document.querySelectorAll(".ts-modal__trigger"), // the buttons
  modal;

document.onclick = function(e) { // document on clickfor (var i = 0; i < modalTrigger.length; i++) { // iterate through each buttonif (e.target == modalTrigger[i] || modalTrigger[i].children) { /* <- added children as target */
      modal = modalTrigger[i].getAttribute("data-activemodal");
      console.log(modal);
    }
  }
}
a {
  background: red;
  padding: 40px;
}

span {
  color: yellow;
}
<aclass="ts-modal__trigger"data-activemodal="ts-main-feed_status-comments-overlay"><span>11</span></a>

Post a Comment for "Onclick Of Button From Paginated Load Not Triggering"