the_little,
если все четыре блока имеют класс step2-blocks, то это код повторять не надо
$(function() {
$(".step2-blocks").each(function(indx, el) {
var add = $(".add", el),
num = add.length;
del = $(".delbutton", el),
n = 1;
function show() {
del.toggle(num > n)
}
show();
$(".addbutton", el).on("click", function() {
++num
show()
});
del.on("click", function() {
num--;
show()
})
})
});
|