Set file limit for input type file with multiple attribute - Javascript jQuery

Javascript examples for jQuery:Form Input

Description

Set file limit for input type file with multiple attribute

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.0.min.js"></script> 
  <script type="text/javascript">
    window.onload=function(){//from w w  w . j a v a 2  s.  c o m
$('.files').change(function(){
    if(this.files.length>1)
        console.log('to many files')
});
    }

      </script> 
 </head> 
 <body> 
  <input type="file" class="files" multiple>  
 </body>
</html>

Related Tutorials