Javascript [removed] resets my <input type=“file”>

前端 未结 1 1560
情话喂你
情话喂你 2021-01-21 11:45

I have a problem concerning multiple file uploads in javascript. I am trying to create my own multiple file upload by dynamically adding inputs. This is all easy as pie, but the

相关标签:
1条回答
  • 2021-01-21 12:22

    Yeah... you're going to want to use appendChild instead of modifying the inner HTML:

    var myInput = document.createElement("INPUT");
    // do stuff to my input
    
    var myContainer = document.getElementById("uploader_holder");
    myContainer.appendChild(myInput);
    

    That's the general gist of what you have to do - let me know if you need somethign more specific, but it looks like you've got a good hold on JS already... You're going to want to do that in almost all cases rather than setting inner HTML... So, building your TR as well... you'll have to append the TD to the TR, you'll have to append the TD with your input, you'll have to append your targeted table with the TR, etc.

    0 讨论(0)
提交回复
热议问题