document.getElementById('buttonid').addEventListener('click', openDialog); function openDialog() { document.getElementById('fileid').click(); }