On my readURL() function in my scrtipt. I would like to know what would be the best method in being able to auto get the ID from my img tag. Because I have mulitple img rows that get created with own id.
What would you think so that the reader.onload part can set it so the selector part where put ID can auto get any id from img tag. And work with the attr 'src'. Currently I have to enter each id in manuall which is bit anoying.
Thanks very much in advance.
**Script **
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#file-input").change(function() {
readURL(this);
});