open file upload dialog on click

前端 未结 3 1145
旧时难觅i
旧时难觅i 2021-01-07 18:00

I have to open file upload dialog by clicking some other button i.e i am hiding file upload control(visibility:hidden) and on clicking of some other button i want to open th

3条回答
  •  既然无缘
    2021-01-07 18:35

    In your example, your file input did not have an id, yet you are trying to reference it with #input. This works for me:

    $('#button').click(function() {
        $('input[type=file]').click();
    });
    

提交回复
热议问题