Created
October 22, 2013 16:54
-
-
Save tubiz/7104154 to your computer and use it in GitHub Desktop.
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
<div class="fake-input" data-input="Input1" style="background: url('/img/blabla.jpg');">Select your file</div> | |
<div class="fake-input" data-input="Input2" style="background: url('/img/blabla.jpg');">Select your file</div> | |
<div class="fake-input" data-input="Input3" style="background: url('/img/blabla.jpg');">Select your file</div> | |
<input id="Input1" type="file" style="display:none" /> | |
<input id="Input2" type="file" style="display:none" /> | |
<input id="Input3" type="file" style="display:none" /> | |
<script type="text/javascript"> | |
$(document).on('click', '.fake-input', function(e) { | |
console.log($('#' + $(this).data('input'))); | |
$('#' + $(this).data('input')).click(); | |
}); | |
$(document).on('change', 'input[type="file"]', function() { | |
$('[data-input="' + $(this).attr('id') + '"]').text($(this).val()); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment