A weird TIL about web development. This JS:
var el=document.createElement("input");
el.type="file";
el.click();
would actually pop up an open file dialog. You don't even need to add it into the DOM.
A weird TIL about web development. This JS: var el=document.createElement("input"); would actually pop up an open file dialog. You don't even need to add it into the DOM. 1 comment
|
Before that, I thought that the <label> hack was required. It's the only way to restyle a file input that works without JS, but at some point I decided that interacting with the content, and creating it, requires JS, while viewing still does not. It's simply easier this way.