fix image replacement bug. use global document instead of child elements only

This commit is contained in:
Dennis Eichhorn 2020-06-10 21:51:28 +02:00
parent 8b214150d6
commit 6691f99f40

View File

@ -213,8 +213,7 @@ export class Form
const self = this; const self = this;
imageUpload.addEventListener('change', function () { imageUpload.addEventListener('change', function () {
const formElement = document.getElementById(id); const preview = document.querySelector('#preview-' + imageUpload.getAttribute('name'));
const preview = formElement.querySelector('img#preview-' + imageUpload.getAttribute('name'));
preview.src = window.URL.createObjectURL(imageUpload.files[0]); preview.src = window.URL.createObjectURL(imageUpload.files[0]);
preview.onload = function () { preview.onload = function () {