Last active
August 29, 2015 14:07
-
-
Save r4fx/129e320ca15d4a36e55a to your computer and use it in GitHub Desktop.
Custom input file
This file contains 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
$(function () { | |
$('_btnBrowse').click(function (e) { | |
e.preventDefault(); | |
$('#inputUpload').click(); | |
}); | |
$('#inputUpload').change(function () { | |
var filename = $('input[type=file]').val().split('\\').pop(); | |
var setContent = $('.inputFile').html(filename); | |
}); | |
}); |
This file contains 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
<form> | |
<span class="inputFile">nie wybrano pliku...</span> | |
<input type="file" name="file" id="inputUpload"> | |
</form> | |
<span class="_btnBrowse">Przeglądaj</span> |
This file contains 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
.inputFile{ | |
border: 1px solid #ccc; | |
padding: 5px 20px; | |
display: inline-block; | |
background-color: #eee; | |
cursor: default; | |
} | |
#inputUpload{ | |
opacity: 0; | |
visibility: hidden; | |
width: 5px; | |
position: absolute; | |
right: 0; | |
top: 0; | |
} | |
.btnBrowse{ | |
display:inline-block; | |
background-color: #ca7fd1; | |
color: #fff; | |
padding: 5px 10px; | |
margin-top: 10px; | |
cursor: pointer; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment