From 6691f99f402a0447400e3226ee2b9806ac7cb50a Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Wed, 10 Jun 2020 21:51:28 +0200 Subject: [PATCH] fix image replacement bug. use global document instead of child elements only --- UI/Component/Form.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/UI/Component/Form.js b/UI/Component/Form.js index 345ab7e..3783c14 100644 --- a/UI/Component/Form.js +++ b/UI/Component/Form.js @@ -213,8 +213,7 @@ export class Form const self = this; imageUpload.addEventListener('change', function () { - const formElement = document.getElementById(id); - const preview = formElement.querySelector('img#preview-' + imageUpload.getAttribute('name')); + const preview = document.querySelector('#preview-' + imageUpload.getAttribute('name')); preview.src = window.URL.createObjectURL(imageUpload.files[0]); preview.onload = function () {