You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
800 B
JavaScript

// let fileName = "";
// window.addEventListener("load", function () {
// let input = document.querySelector('input[type="file"]');
// input.addEventListener("change", function () {
// if (this.files && this.files[0]) {
// fileName = this.files[0].name;
// let img = document.querySelector("img");
// img.onload = () => {
// img.classList.add("visible");
// input.classList.add("hidden");
// URL.revokeObjectURL(img.src); // no longer needed, free memory
// };
// img.src = URL.createObjectURL(this.files[0]); // set src to blob url
// }
// });
// });
const imageButton = document.getElementById("show-image");
imageButton.addEventListener("click", (e) => {
let img = document.querySelector("img");
img.classList.toggle("hidden");
});