Skip to content
Advertisement

Images not displaying on dynamic generated content

I’m working on uploading multiple images one at a time by dynamically generating the input field and image element. However, my code doesn’t display the images on the dynamically generated image element.

JavaScript
JavaScript

Advertisement

Answer

Instead of making event handler for all files use can just one event handler and then inside your readURL function use .closest('div').find('img') to add src to image tag.

Demo Code :

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement