Skip to content Skip to sidebar Skip to footer

Javascript File Input Onchange Not Working [ios Safari Only]

The code below works everywhere except on safari mobile. Apparently the onchange is never triggered. // create a hidden file input element var input = document.createElement('in

Solution 1:

I'll be damned: on iOS safari two extra conditions are necessary compared to other browsers:

1) The input must be actually appended to the DOM.

2) setting .onchange won't work: addEventListener must be used instead.

Post a Comment for "Javascript File Input Onchange Not Working [ios Safari Only]"