'Is possible get attribute value and manipulate tags added by Javascript?
I am trying to integrate an image matcher into a constructor that uses lodash. The builder uses lodash in the live editor and php for the public part. In the public part everything works correctly.
But in the editor it doesn't and it shows me the error Uncaught TypeError: this.el is null. which means that the element has not been found. But the element exists only that it is added by lodash. So my question is: Is it possible to get the ID attribute and manipulate elements added by Javascript (lodash)?
Lodash Code
<# if(image_before.src && image_before.src) { #>
<div class="image-compare-image">
<div id="image-compare-1652909731591" class="image-compare-image-ct">
<img class="sppb-img-responsive" src="source-here" alt="Alt">
<img class="sppb-img-responsive" src="source-here" alt="alt">
</div>
</div>
<# } #>
JS
const compare_1652909731591 = document.getElementById("image-compare-1652909731591");
const viewer_1652909731591 = new ImageCompare(compare_1652909731591).mount();
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
