5
My intention is:
A listing where it is possible to add <div>
and delete the added Divs with a "button" inserted into each div
.
The page already comes with some divs
fixed inserts which are equal to those to be added.
The point is, in the divs
that are already on the page, the erase button works correctly, now the divs
which are inserted with prepend
are not deleted. I have checked the function of the remove()
and all the divs
both fixed and added have the same class. Finally...
list-mode
is the div
which encompasses all of these divs
in html, .img_des_row
is the div
which must be repeated and erased... Recalling: the addition is working properly!
Javascript:
$("#bt-adicionar-imagens").click(function() {
$(".list-mode").prepend("< div class='img_des_row col-xs-12'>< div class='col-xs-8 no-pad-left'>< div class='description_img'>Lorem ipsum dolor sit amet consectetur adipisicing elit, sed do elusmod tempor.< /div>< /div>< div class='col-xs-2'><div class='pull-right margin-top_20 dropdown'><a href='#' class='icon-dwn-med pull-left margin_l_r_5'>< /a>< a href='#' class='icon-edit-med pull-left margin_l_r_5 dropdown-toggle' data-toggle='dropdown'>< /a>< div class='dropdown-menu alt-color-scheme left pad'>< /div>< a href='#' class='icon-trash-med pull-left margin_l_r_5'>< /a>< /div>< /div>< /div>");
});
$('.img_des_row .icon-trash-med').on('click', function(e) {
$(this).closest(".img_des_row").remove();
});
If I can create a jsFiddle (and also post your html here in question), with a representation of your real problem, with your html and your JS, so we can try to help you, and also your question is not very confusing, try to reread and try to improve it. And take a look at us markdown here from the site, I formatted your code and some of your question to make it easier to read
– Fernando Leal
Thanks Fernando. I retreated 4 spaces and was not, probably got it wrong and then I opened the <div> to show the code, thanks for helping. I will use jsFiddle.
– user49915