I’m trying to style an input type=”file” element by hiding it and creating a link to click the input element. My code works on an iPhone 5 but not on my Galaxy Nexus (Android).
My code:
<input id="files" type="file" accept="image/*;" class="hidden" />
<div id="button" onclick="files.click();">Take picture</div>
What do I have to do to make it work on Android?
I would comment on your question, but I do not have enough reputation. There you might find the answer to your question (or rather explanation, why it does not work – security reasons):
In JavaScript can I make a "click" event fire programmatically for a file input element?