Adding file inputs dynamically with jquery?

后端 未结 4 461
萌比男神i
萌比男神i 2021-01-20 00:29

To make my weppage as compatible as possible I will go with the regular file input, the problem is that I need to offer multiple uploads.

My thought is that when the

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-20 00:49

    if you want to have diffrent input names

    var i;
    $('#addFile').click(function() {
        i=i+1;
        $('#filesContainer').append(
            $('').attr('type', 'file').attr('name', 'file'+i)
        );
    });
    

提交回复
热议问题