I have this screen to insert images in the system, the part of the insert works correctly, but I want that when clicking on an image, the edit button appears in the image, and if I click again on that image, this collapse of the bootstrap, and I decided to try, but I can not make it work
What I did was, html is dynamically created as in the code below:
var reader = new FileReader();
reader.onload = (function(imageFile){
return function(e){
//Render Thumnails
var li = $('<li/>',{class:"col-xs-12 col-sm-6 col-md-3 col-lg-3"});
var a = $('<a/>',{
href:"javascript:void(0)",
class:"thumbnail"
});
var button = $('<button/>',{
class:"btn btn-success collapse",
type:"button",
id:"teste",
html:"Editar"
});
var image = $('<img/>',{
toggle:"collapse",
target:"#teste",
src:e.target.result,
title:escape(imageFile.name)
}).appendTo(a).click(function(){
$('#imageList').data('current', $(this).attr('src'));
//alert($(this).attr('src'));
image_x = ($(this).attr('src'));
li.append(button).appendTo($('#imageList'));
});
li.append(a).appendTo($('#imageList'));
}
})(f);