$("#btnSelect").click(function() { var $input = $('<input type="file" />'); $input.change(function() { console.log("selected file:" + $(this).val()); }); $input.trigger('click'); });