javascript - Want a Button But Have to Use Input Where Type=File? -


i have import button want this:

enter image description here

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:

enter image description here

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> 

Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo