$(document).ready(function(){
//항목추가
$(".btn_add").click(function(){
var html = '';
html += '<div>';
html += '<a href="#none" class="btn_up">위로이동</a> ';
html += '<a href="#none" class="btn_down">아래로이동</a> ';
html += '<select name="" id="">';
html += '<option value="">선택</option>';
html += '</select> ';
html += '<input type="" /> ';
html += '<a href="#none" class="btn_del">삭제</a>';
html += '</div>';
$("div.add").append(html);
});
});
//항목삭제
$(document).on("click",".btn_del",function(){
$(this).parent().remove();
});
//항목 위치 위로이동
$(document).on("click",".btn_up",function(){
console.log("위로이동");
var test = $(this).parent().prev();
test.before($(this).parent());
});
//항목 위치 아래로이동
$(document).on("click",".btn_down",function(){
console.log("아래로이동");
var test = $(this).parent().next();
test.after($(this).parent());
});
<div id="layout">
<div>
<a href="#" class="btn_up">위로이동</a>
<a href="#" class="btn_down">아래로이동</a>
<select name="" id="">
<option value="">선택</option>
</select>
<input type="" />
<a href="#" class="btn_del">0삭제</a>
</div>
<div>
<a href="#" class="btn_up">위로이동</a>
<a href="#" class="btn_down">아래로이동</a>
<select name="" id="">
<option value="">선택</option>
</select>
<input type="" />
<a href="#" class="btn_del">1삭제</a>
</div>
<div>
<a href="#" class="btn_up">위로이동</a>
<a href="#" class="btn_down">아래로이동</a>
<select name="" id="">
<option value="">선택</option>
</select>
<input type="" />
<a href="#" class="btn_del">2삭제</a>
</div>
</div>
<a href="#" class="btn_add">추가</a>