下面有一个html表,当我从clone中添加一个新行时,我想删除克隆行的select-txtposting中的第一个选项,但是它在父行select-txtposting中删除,而不是在clone行select中删除-txtposting,我该怎么做?
这是表格 enter image description here
在图像中,第二行是克隆行,我想删除第二行中发布类型的第一个选项,更改第二行当前发行数量的输入,但不更改第一(父)行的任何值。 / p>
$("#select-product").change(function () {
document.getElementById('select-product').disabled = true;
var mrqno = $("#select-product :selected").val();
$.ajax({
type: "POST",
url: "/StockTransfer/CallMRN_No?MRNNO=" + mrqno,
contentType: "application/; charset=utf-8",
dataType: "json",
async: false,
success: function (grnhdmethod) {
if (grnhdmethod.length > 0) {
var i = 0;
$.each(grnhdmethod, function (index, item) {
debugger;
var row = '<tr>';
row += '<td class="ProId" id="idPoNum" style="width: 30px " >' + $(this).attr('ItemId') + '</td>';
row += '<td class="MRNNo" id="idMrnNum">' + $(this).attr('MaterialRequest_No') + '</td>';
row += '<td class="MRNNo" id="idMrnNum">0</td>';
row += '<td class="select-ind" dir="rtl">' +
'<select id="select-txtpro' + index + '" class="select-Id" style="width: 100px " dir="ltr" >"<option>--Product--</option>"</select></td>';
row += '<td class="BudgetQty" >' + '<input type="text" class="bdgt-qty form-control col-md-3 center-block input-sm" id="bdgt-qty-' + $(this).attr('ItemId') + '" disabled="true" style="width: 75px">' + '</td>';
row += '<td class="UnitCode">' + $(this).attr('UnitCode') + '</td>';
row += '<td class="UnitPrice">' + $(this).attr('UnitPrice') + '</td>';
row += '<td class="ordrQty">' + $(this).attr('Quantity') + '</td>';
row += '<td class="allreadyrecived">' + $(this).attr('finalval') + '</td>';
row += '<td class="stockval">' + '<input type="text" class="input-stk form-control col-md-3 center-block input-sm" id="input-stk-' + $(this).attr('ItemId') + '" disabled="true">' + '</td>';
row += '<td class="totoverissue">' + $(this).attr('TotalOverIssue') + '</td>';
row += '<td class="OverIssueQty" id="over-issue" dir="rtl" align="right">0</td>';
row += '<td class="select-postype" dir="rtl">' +
'<select id="select-txtposting" class="select-PosType" style="width: 75px " dir="ltr" disabled="true"></select>' + '</td>';
if ($(this).attr('TotalOverIssue') > 0) {
row += '<td class="blncQty" id="bal" dir="rtl" align="right">0</td>';
}
else {
row += '<td class="blncQty" id="bal" dir="rtl" align="right">' + ($(this).attr('Quantity') - $(this).attr('totalrecieve')) + '</td>';
}
if ($(this).attr('Quantity') <= $(this).attr('totalrecieve')) {
row += '<td class="col-md-1 inpqty" dir="rtl">' + '<input type="text" class="input-qty form-control col-md-3 center-block input-sm" data-id="input-qty" disabled="true">' + '</td>';
return true;
}
else {
row += '<td class="col-md-1 inpqty" dir="rtl">' + '<input type="text" class="input-qty form-control col-md-3 center-block input-sm" id="input-qty-' + $(this).attr('ItemId') + '" value="0" style="width: 75px " disabled="true">' + '</td>';
}
row += '<td class="col-md-1 btnadd" dir="rtl">' + '<input type="button" class="AddNew" value="Add" style="width: 50px ">' + '</td>';
row += '</tr>';
table.append(row);
$.each(item.Products, function (i,product) {
$('#select-txtpro'+index).append(
$("<option></option>")
.text((product.ProductName) + ' - ' + (product.SupplierName) + ' - ' + (product.Product_ProductCode))
.val(product.ProductId)
.attr('ProductId', item.ProductId)
.attr('ProductName', item.ProductName)
);
})
});
}
}
});
});