I'm using a preview script for images created with jquery, however I want to accomplish it in Javascript Vanilla, I'm looking for a way to override the variableQualquer.empty (); but I did not find, how can I replace this command?
JQuery code
$("#fileUpload").on('change', function () {
if (typeof (FileReader) != "undefined") {
var image_holder = $("#image-holder");
image_holder.empty();
var reader = new FileReader();
reader.onload = function (e) {
$("<img />", {
"src": e.target.result,
"class": "thumb-image"
}).appendTo(image_holder);
}
image_holder.show();
reader.readAsDataURL($(this)[0].files[0]);
} else{
alert("Este navegador não suporta FileReader.");
}
});