javascript - Open file dialog when input type button -


in html know using input type file file dialog select file. there way open file dialog using input type button? used

<input type="file" class="file" name="attachement" /> 

but want use

<input type="button" class="file" name="attachement" /> 

yes - can hide input type="file" still have in markup. show regular button on page , onclick of button, programmatically trigger click event of actual file input:

<input id="fileinput" type="file" style="display:none;" /> <input type="button" value="choose files!" onclick="document.getelementbyid('fileinput').click();" /> 

fiddle: http://jsfiddle.net/cnjf50vd/


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -