i made a button that takes an image as an input but i cant find a way to show the picture. i have tried to make an empty element and then change its URL like i saw on a different website but it didnt work.
HTML
<input id="myImage" class="photo-upload" type="file" accept="image/*, image/jpeg"> <img id="the-picture" width="200" />
JavaScripts
const uploadPictureButton = document.querySelector(".photo-upload"); uploadPictureButton.addEventListener("click", displayPicture); function displayPicture(event) { let image = document.getElementById("myImage"); image.src = URL.createObjectURL(event.target.files[0]); };