Answers for "image preview after input image jquery"

1

image preview after input image jquery

function readURL(input) {
  if (input.files && input.files[0]) {
    var reader = new FileReader();
    reader.onload = function(e) {
      $('#previewHolder').attr('src', e.target.result);
    }
    reader.readAsDataURL(input.files[0]);
  } else {
    alert('select a file to see preview');
    $('#previewHolder').attr('src', '');
  }
}

$("#filePhoto").change(function() {
  readURL(this);
});
Posted by: Guest on October-21-2021

Code answers related to "image preview after input image jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language