Код: Выделить всё
$(document).ready(function() {
var counter = 2;
$("#addButton").click(function() {
if (counter < 2) {
alert("Add more textbox");
return false;
}
var newTextBoxDiv = $(document.createElement('div'))
.attr("id", 'TextBoxDiv' + counter);
newTextBoxDiv.after().html('Textbox #' + counter + ' : ' +
'' +
'');
newTextBoxDiv.appendTo("#TextBoxesGroup");
counter++;
});
$("#removeButton").click(function() {
$("#TextBoxDiv" + counter).remove();
if (counter == 2) {
alert("No more textbox to remove");
return false;
}
});
});
Код: Выделить всё
Textbox #1 :

Мне нужно сделать кнопку удаления функциональной. Когда я нажимаю соответствующую кнопку сбоку, удаляется только текстовое поле рядом с ней.
Подробнее здесь: https://stackoverflow.com/questions/421 ... ve-textbox