I want to add input (type file) field to my html using js. I've got it done, but the problem is when the user chooses a file then clicks on the "new file" button to choose another one, The prevoius choosen file goes away and says no file chosen. what is the problem?
function newfile(){
var divv=document.getElementById("files");
var name="files"+divv.childNodes.length;
divv.innerHTML+='<div><input id="'+name+'" name="'+name+'" type="file" accept="*" class="col-lg-11 col-md-10 col-sm-10 col-sx-6"></div>';
}
<div class="col-sm-10">
<div id="files"></div>
<a class="btn btn-primary col-sx-12" onclick="newfile()">New file</a>
</div>