Home>

A beginner who doesn't know HTML/javascript at all.
When selecting a file with, I want to display a thumbnail in the case of an image file. How can I avoid displaying the thumbnail that was displayed first when canceling or selecting a file other than an image when selecting a file again?

Things I tried (although the following content was based on another site, I can hardly understand the honest content ...)




Preview test/selected image file






When you execute with the above code, an image file is displayed when you select an image file, but the first selected image remains even if you select a file other than the image file again or select Cancel It will remain.

  • Answer # 1

    It seems like you can't pick up the cancellation of the file dialog
    If you can't avoid it, can you clear it when you click it?