title: Jquery / Javascript check if input file is got files or not
body: <p>//This is not a a duplicate question but what i need to do is check that a file input element has got files or not from anywhere in my javascript code without depending on built in events<br></p>
  
  <p><strong>//forexample...</strong></p>
  
  <pre><code>$('input_element').change(function(event){
                      //code...
                      //any code here but
                      if(event.target.files.length&gt;0){
                          //files around/selected
                      }else{
                          //code..
                          //files not around/selected
                      }
                  })
  
  
                  //But i need to check if files selected without that event ( anonymously... )
                  //like
  
                  if($('input_element').get(0).files.length&gt;0){
                      //code
                      //here i get an error "can not read propert length of undefined!"
                      console.log('files are selected!')
                  }else{
                      //code ...
                      //do something...
                  }
  
              **//any help appreciated!**
  </code></pre>