Created
October 24, 2014 08:39
-
-
Save luctraonmilin/05f956efa892b8a9ad97 to your computer and use it in GitHub Desktop.
Custom HTML file select button trick
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title></title> | |
<script type="text/javascript"> | |
function selectFile() { | |
document.getElementById('file').click(); | |
} | |
</script> | |
<style type="text/css"> | |
#select-file { | |
color: #fff; | |
background-color: #444; | |
padding: 4px 8px; | |
display: inline-block; | |
border-radius: 4px; | |
} | |
#select-file:hover { | |
background-color: #777; | |
cursor: pointer; | |
} | |
</style> | |
</head> | |
<body> | |
<input type="file" style="display: none;" id="file"> | |
<div id="select-file" onclick="selectFile();"> | |
Select file | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment