-1
<input type="file" name="inputFileElement" id="inputFileElement">

<script type="text/javascript">
    setTimeout(function() {
        document.getElementById("inputFileElement").click();
    }, 3000);
</script>

I want to fire click Event after 3s. But this is not working... It works when setTimeout(..., 300)

I do not know what I'm doing wrong.

uladzimir
  • 5,639
  • 6
  • 31
  • 50

1 Answers1

1

Your code is working

Take a look at this: http://jsfiddle.net/ddan/mbqf34hz/

<div id="cl" onclick="alert('click!!!');"></div>
setTimeout(function() {
    document.getElementById("cl").click();
}, 3000);
DDan
  • 8,068
  • 5
  • 33
  • 52