I have no idea why JS cannot understand the data-img attributes. It should be simple, but I’m missing something here. Please check codepen for the example
The images come from the backend, so they are put inside “data-img” attribute.
I’m using the FileUploadWithPreview library to preview form images. In this particularly case, I want to preview already uploadED images. That’s why I’m feed data-img with the images from DB. So, I can use JS to read that, and use the presetFiles option from the library to show those images.