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
775 B
JavaScript

3 years ago
// let fileName = "";
3 years ago
// 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
// };
3 years ago
3 years ago
// 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");
3 years ago
img.classList.toggle("hidden");
});