mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 17:58:41 +00:00
fix image replacement bug. use global document instead of child elements only
This commit is contained in:
parent
8b214150d6
commit
6691f99f40
|
|
@ -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 () {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user