1
I am trying to align the input below each image after uploading using file Reader. Follow screen print and codes:
JS:
$(function() {
var imagesPreview = function(input, placeToInsertImagePreview) {
if (input.files) {
var filesAmount = input.files.length;
for (i = 0; i < filesAmount; i++) {
var reader = new FileReader();
reader.onload = function(event) {
$($.parseHTML('<img class="img-galeria img-thumbnail img-galeria" >')).attr('src', event.target.result).appendTo(placeToInsertImagePreview);
$($.parseHTML('<input class="form-control painel-input-galeria" type="text" name="titulo-img" placeholder="título da imagem">')).appendTo(placeToInsertImagePreview);
},
reader.readAsDataURL(input.files[i]);
}
}
};
$('#imagem').on('change', function() {
imagesPreview(this, 'div.galeria');
});
});
HTML
CSS already tried several alternatives and could not.
HMTL <div class="gallery"></div> </div> <hr> <input id="image" type="file" Multiple />
– Angelo Pacheco