Kalyani Shevale

Kalyani Shevale

  • NA
  • 3.2k
  • 701.7k

how to get className value using id in jquery

Dec 6 2018 12:48 AM
I want class name value using id but input type is file.
  1. <input type='file' id="imgInp"  file="file" class="@userSurvey.Id"/>  
 jquery Code
  1. $('input[type="file"]').change(function(e){  
  2.     var fileName = e.target.files[0].name;  
  3.     $.each($('#imgInp')[i].files, function (i, file) {  
  4.         
  5.         fileData.append('file-' + i, e.target.files[i]);  
  6.        
  7.         });  
  8.      
  9.     alert('The file "' + fileName +  '" has been selected.');  
  10. });  
 how to get classname value 

Answers (1)