1 回答
TA贡献2039条经验 获得超7个赞
您需要对 HTML 文件进行更改,例如:
input
将您的元素替换为button
并应用与 wrapper 相同的样式div
。将单个行包围在容器中
单击时删除单击按钮的容器
例如:
$("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>
添加回答
举报