I know there are some questions up which look like mine, but in this case I want the remove button to be removed as well and I don't know how I can do this.
Here is my question:
I append 3 elements with jQuery when an append button is clicked. Including a remove button.
I want this remove button to remove it self and the other two elements. The counter should make identical Id's, but i'm not sure if i did this right way with jQuery.
How can i delete three elements including the remove button onclick?
$(function() {
var counter = 0;
$('a').click(function() {
$('#box').append('<input type="checkbox" id="checkbox" + (counter) + "/>');
$('#box').append('<input type="text" id="t1" + (counter) + "/>');
$('#box').append('<input type="button" value="." id="removebtn" + (counter) + "/>');
$("#box").append("<br />");
$("#box").append("<br />");
counter++;
});
$('removebtn').click(function() {
remove("checkbox");
});
});