-1
$('button').click(function(){
    $.get('foo.php', function(data){
        $('body').append(data);

        $('.f').trigger('click');
    });
});

//foo.php
<input class="f" type="file" >

I have a button, when it clicked, it will get data from another page and append data on body.

after get() append() the data, I want to trigger input file, but its not working

I have try only append without get() and it works.

anyone know why its not working when I use get()?

Ben
  • 2,562
  • 8
  • 37
  • 62

1 Answers1

0

try this it is working

document.getElementsByClassName('.f')[0].click();

Man Programmer
  • 5,300
  • 2
  • 21
  • 21