Created
February 2, 2016 07:53
-
-
Save gabskoro/0a8875504abfa82a7e7a to your computer and use it in GitHub Desktop.
Show an image
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() { | |
var $logoInput = $('#logo-input'); | |
var $logoImage = $('.logo-image'); | |
function readURL(input) { | |
if (input.files && input.files[0]) { | |
var reader = new FileReader(); | |
reader.onload = function(e) { | |
$logoImage.attr('src', e.target.result); | |
}; | |
reader.readAsDataURL(input.files[0]); | |
} | |
} | |
$logoInput.change(function() { | |
readURL(this); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment