I have a resize image function which takes as input the ID of an file input element and .onchange it takes the image in the form and outputs a resized canvas of the image. Now I have changed the form structure from a static form where I know the IDs to a dynamically generated form where I only know the class of the input.
<input type="file" class"image" id="some database genererated id such as 857432">
How to do I modify the function to notice when a file input element of class="image" is .onchange and then perform the resize function on that particular element?
function resizeImage(inputfile, outputcontainer, outputname) {
document.getElementById(inputfile).onchange = function(e) {
var file = e.target.files[0]
var image = new Image(file);
etc.....
};
}