search

Home  >  Q&A  >  body text

Even after clearing, the value of my file input remains

As you can see in the screenshot. I select a file, keep the popup without refreshing the page, and then open it again and the file input is still the file I selected.

<input id="fileuploadbannermobile" type="file" name="files[]">

I try this while the popup is open.

$("#fileuploadbannermobile").val('');

But it doesn't seem to solve the problem.

P粉714780768P粉714780768241 days ago530

reply all(1)I'll reply

  • P粉523335026

    P粉5233350262024-04-07 10:47:55

    Setting the input value to an empty string or null will definitely work.

    • Try setting value to "" or null in vanila javascript

      yourInput.value = null or yourInput.value = ""

    • Also check that you have set these values ​​to the correct input

    It is also useful to know which browser you are using.

    reply
    0
  • Cancelreply