Guest User

хаханьки

a guest
Sep 19th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. alert('ok');
  2. var imgPreview = document.querySelector('.img-preview img');
  3.  
  4. var loadImg = function(input) {
  5.   if (input.files && input.files[0]) {
  6.     var reader = new FileReader();
  7.     alert ("ok2");
  8.     reader.onload = function(e) {
  9.       imgPreview.src = e.target.result;
  10.     }
  11.     reader.readAsDataURL(input.files[0]);
  12.   }
  13. }
  14.  
  15. document.querySelector('#img').onchange = function() {
  16.   loadImg(this);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment