Spaces:
Sleeping
Sleeping
File size: 504 Bytes
8ba62ed | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | const imageInput = document.getElementById("imageInput");
const preview = document.getElementById("preview");
const previewBtn = document.getElementById("previewBtn");
const imageBox = document.getElementById("imageBox");
previewBtn.addEventListener("click", function(){
if (!imageInput.files.length) {
alert("Please upload an image first");
return;
}
const file = imageInput.files[0];
preview.src = URL.createObjectURL(file);
imageBox.style.display = "block";
}); |