How To Include Childnodes When Targeting Dynamically Generated Elements In Javascript?
I currently have buttons dynamically generated onto the page with plain JavaScript. Example
<divid="wrapper"><buttonclass="c-config__option c-config__option--button c-config__option--pack"data-index="0">
Item 1
<span>Subtext</span></button><buttonclass="c-config__option c-config__option--button c-config__option--pack"data-index="1">
Item 2
<span>Subtext</span></button></div>
As an alternative you can replicate jQuery.closest using the code from this SO post: DOM / pure JavaScript solution to jQuery.closest() implementation?
Post a Comment for "How To Include Childnodes When Targeting Dynamically Generated Elements In Javascript?"