Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alert('ok');
- var imgPreview = document.querySelector('.img-preview img');
- var loadImg = function(input) {
- if (input.files && input.files[0]) {
- var reader = new FileReader();
- alert ("ok2");
- reader.onload = function(e) {
- imgPreview.src = e.target.result;
- }
- reader.readAsDataURL(input.files[0]);
- }
- }
- document.querySelector('#img').onchange = function() {
- loadImg(this);
- }
Advertisement
Add Comment
Please, Sign In to add comment