Javascript .click() not firing in safari -


i have file upload input in application , i'm using link , javascript open dialog.

<a class="uploadlink" style="cursor:pointer" onclick="document.getelementbyid('file').click()">open</a>  <input type="file" name="file" id="file" style="display:none" onchange="document.getelementbyid('txt').value = this.value"/> 

my code working in browsers , devices except safari , apple devices. when click link , check link console doesn'teven register error. can suggest solution?

since had display:none in safari not not rendered not referenced. have changed code follows.

jquery solution

<a class="uploadlink" style="cursor:pointer" onclick="$('#file').trigger('click');">open</a> <input type="file" name="file" id="file" style="opacity:0" onchange="document.getelementbyid('txt').value = this.value"/> 

javascript solution

 <a class="uploadlink" style="cursor:pointer"  onclick="document.getelementbyid('file').click();">open</a> 

it working in safari.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -