Skip to content

Instantly share code, notes, and snippets.

@hernanvicente
Created June 27, 2014 16:55
Show Gist options
  • Save hernanvicente/dd2c2b8a19104ff10ff1 to your computer and use it in GitHub Desktop.
Save hernanvicente/dd2c2b8a19104ff10ff1 to your computer and use it in GitHub Desktop.
<script type="text/javascript" src="jquery-1.10.2.min.js"></script>
<script>
$(document).ready(function(){
$("#image").change(function(){
var file = document.getElementById("image").files[0];
var readImg = new FileReader();
readImg.readAsDataURL(file);
readImg.onload = function(e) {
$('.prevImg').attr('src',e.target.result).fadeIn();
}
})
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment