I have the following function.
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#preview').attr('src', e.target.result);
};
reader.readAsDataURL(input.files[0]);
}
}
And I want to be able to call it with the id file, but leaving it ready so that if I want to use it again with the id file_2, I can do it. I'm very green in this. I started with this:
$('#file').change(function () {
$(this).
});
But in the $(this).
I stay blocked. Does someone help me?