1 回答

TA貢獻(xiàn)2039條經(jīng)驗(yàn) 獲得超8個(gè)贊
您需要對(duì) HTML 文件進(jìn)行更改,例如:
input
將您的元素替換為button
并應(yīng)用與 wrapper 相同的樣式div
。將單個(gè)行包圍在容器中
單擊時(shí)刪除單擊按鈕的容器
例如:
$("form .removeCode").click(function(event) {
$(this).parent(".container").remove();
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form>
<div class="container">
<div class="col-2 selectedRow">014</div>
<div class="col-4 selectedRow">Test</div>
<div class="col-2 selectedRow">Special Charge</div>
<div class="col-2 selectedRow">012</div>
<button type="button" class="col-2 selectedRow removeCode">Remove</button>
</div>
</div>
<div class="container">
<div class="col-2 selectedRow">012</div>
<div class="col-4 selectedRow">Test 2</div>
<div class="col-2 selectedRow">Other Charge</div>
<div class="col-2 selectedRow">011</div>
<button type="button" class="col-2 selectedRow removeCode">Remove</button>
</div>
</form>
添加回答
舉報(bào)