Created
May 8, 2014 16:02
-
-
Save ckahle33/30a0d693335bd4c35ea7 to your computer and use it in GitHub Desktop.
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
$(document).ready(function() { | |
$('input[type=file]').each(function(){ | |
$(this).parent().append($('<div class="fakefile" />').append($('<img src="/assets/img/file-button.png" alt="File input button" />'))); | |
$(this).on('click', function(){ | |
$('input#input_1_12').click(); | |
}) | |
}); | |
}); |
fleeting
commented
May 8, 2014
$(document).ready(function() {
$('input[type=file]').each(function(){
var input = $(this);
input.parent().append($('<div class="fakefile '+input.attr('id')+'" />').append($('<img src="/assets/img/file-button.png" alt="File input button" />')));
$('.fakefile.'+input.attr('id')).on('click', function(){
input.click();
});
input.on('change',function(){
console.log(this.value.replace("C:\\fakepath\\", ""));
});
});
});
$(document).ready(function() {
$('input[type=file]').each(function(){
var input = $(this);
var fakefile = $('.fakefile.'+input.attr('id'));
input.parent().append($('<div class="fakefile '+input.attr('id')+'" />').append($('<img src="/assets/img/file-button.png" alt="File input button" />')));
fakefile.on('click', function(){
input.click();
})
input.on('change',function(){
fakefile.text(this.value.replace("C:\\fakepath\\", " "));
});
});
});
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment