Skip to content
Advertisement

image is not show in img tag when upload it again

I use the following method to upload an image and display it in an img tag. Another button is used to delete that image. Upload and delete are working well, but the problem is when I want to upload an image again after it has been deleted. It does not be show up and when I open the console it did not find the image src. The problem occurs only when I delete the image using the delete button.

JavaScript
JavaScript

Advertisement

Answer

Your file field isn’t triggering the ‘onchange’ event after delete, one way to go about this is to trigger it manually in your delete method.

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