I have a simple HTML document with the following code:
<form method="post" action="/upload_file" enctype="multipart/form-data" id = "fileForm">
<button id="chooseFileButton">
Choose File
<input id="fileInput" type="file" name="file" accept="application/vnd.ms-excel"/>
</button>
<button id="uploadFileButton" type="submit">Upload File</button>
</form>
<style>
#fileInput {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
opacity: 0;
}
</style>
So here file input is hidden and is inside of the button. Now in Google Chrome when I click the button it opens file dialog as I want. But in Firefox it tries to navigate to the URL in form's action attribute. How I can make Firefox to behave with my HTML like Chrome does? What is the reason of Firefox behaving like this?