How to display file name for custom styled input file using jquery?

前端 未结 7 1343
我寻月下人不归
我寻月下人不归 2020-12-02 15:49

I have styled a file input using CSS:

7条回答
  •  心在旅途
    2020-12-02 16:30

    You can use this for multiple file upload also

    updateList = function() {
      var input = document.getElementById('file');
      var output = document.getElementById('fileList');
    
      output.innerHTML = '
      '; for (var i = 0; i < input.files.length; ++i) { output.innerHTML += '
    • ' + input.files.item(i).name + '
    • '; } output.innerHTML += '
    '; }
    
    
    Selected files:

提交回复
热议问题