javascript - Want a Button But Have to Use Input Where Type=File? -
i have import button want this:
the html looks this:
<button on-read-file="importtasks(contents)" class="btn btn-default" ng-click="importtasks();">import</button>
however, because want button open file, research shows need use input control , looks this:
here html it:
<input type="file" on-read-file="importtasks(contents)" class="btn btn-default" ng-click="importtasks();"></input>
i don't need input box, , don't need button browse. want functionality of second option, of first. possible?
hide input , use label "for" attribute matches input's id. style label want.
<input type="file" id="abc" hidden> <label for="abc">import</label>
edit
for completeness, here's actual code used. because button wrapped in label, no styling necessary.
<input id="hiddenimport" style="display:none" type="file" on-read-file="importtasks(contents)" ng-click="importtasks();"/> <label for="hiddenimport"><button class="btn btn-default" ng-disabled="loading">import</button></label>