How do you style an input type=\"file\"
button?
The best way I have found is having an input type: file
then setting it to display: none
. Give it an id
. Create a button or any other element you want to open the file input.
Then add an event listener on it (button) which when clicked simulates a click on the original file input. Like clicking a button named hello but it opens a file window.
Example code
//i am using semantic ui
javascript
var attachButton=document.querySelector('.attach-button');
attachButton.addEventListener('click', e=>{
$('#file').trigger("click")
})