Answers for "get field type file js and loop"

0

get field type file js and loop

// For multiple
$("#my-form").find("input[type=file]").each(function(index, field){
  for(var i=0;i<field.files.length;i++) {
    const file = field.files[i];
    if(file.size > 5242880 || file.fileSize > 5242880) {
      errorMessage = 'Files must be less than 5MB.';
      alert(errorMessage);
    }
  }
});
Posted by: Guest on October-20-2020
0

get field type file js and loop

$("#my-form").find("input[type=file]").each(function(index, field){
   const file = field.files[0];
   if(file.size > 5242880 || file.fileSize > 5242880) {
      errorMessage = 'Files must be less than 5MB.';
   }
});
Posted by: Guest on October-20-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language