How do I pass one variable on the function previewImages
?
document.querySelector('#file-input0').addEventListener("change", previewImages,false);
document.querySelector('#file-input1').addEventListener("change", previewImages,false);
I want this script to call the function:
function previewImages(i){
var preview = document.getElementById("preview"+i);
if (this.files) {
[].forEach.call(this.files, readAndPreview);
}}
Everytime I tried this I cant achieve passing the variable value. I want to implement this in pure javascript.