I read all the material but couldn't find the answer. I want remove a file from input file(multiple) by index in jquery . This is my code.But I could not write a function to delete the index file. I need the file deletion function by index.
$("#file").change(function () {
 
  
 //Get count of selected files
 var countFiles = $(this)[0].files.length;
 var imgPath = $(this)[0].value;
 var extn = imgPath.substring(imgPath.lastIndexOf('.') + 1).toLowerCase();
 var image_holder = $("#image-holder");
if(countFiles<=10){
 if (extn == "png" || extn == "jpg" || extn == "jpeg") {
     if (typeof (FileReader) != "undefined") {
         //loop for each file selected for uploaded.
         for (var i = 0; i < countFiles; i++) {
             var reader = new FileReader();
             reader.onload = function (e) {
                 $(image_holder).append("<div class='col-md-2'>  <div class='card bg-dark text-white o-hidden mb-4'> <img class='card-img' src='"+e.target.result+"' style='width:100px;height:100px' alt='Card image'> <button class='btn btn-danger' onclick='file_remove('"+i+"')'>remove</button> </div> </div>");
                
             }
             image_holder.show();
             reader.readAsDataURL($(this)[0].files[i]);
         }
     } else {
         alert("This browser does not support FileReader.");
     }
 } else {
     alert("Pls select only images");
 }}
}); 
     
    
`, without attaching the file input to your document using `var fileInput = $(""); fileInput.change(function(){ for(var i=0,files=this.files,path,file,l=files.length; i
– StackSlave Dec 11 '19 at 00:38