Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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);
    }
  }
});
Comment

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.';
   }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: display month friday 13th javascript year 
Javascript :: how to send dm to every member in discord with discord.js 
Javascript :: script defer attribute 
Javascript :: js add props to obj conditionally 
Javascript :: gsap keyframes 
Javascript :: how to reload automaticaly in vue 
Javascript :: javascript max date 
Javascript :: what is angularjs 
Javascript :: exponent javascript 
Javascript :: delete embeds field discord.js 
Javascript :: area selection on image using javascript 
Javascript :: regex match between quotes without escape 
Javascript :: transition css with js 
Javascript :: jest called times 
Javascript :: hook use effect with hooks 
Javascript :: what is javascript used for 
Javascript :: jquery onchange event 
Javascript :: componentwillreceiveprops for functional component 
Javascript :: react native refresh on pull down 
Javascript :: js not startswith 
Javascript :: When JavaScript was invented month?* 
Javascript :: import file in chrome extension 
Javascript :: stop execution javascript 
Javascript :: how to draw a flower in javascript 
Javascript :: js insert in array 
Javascript :: Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 50 seconds. 
Javascript :: ejs 
Javascript :: react particles js 
Javascript :: input hook react 
Javascript :: variables in js class 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =