我正在
无法设置未定义或空引用的属性“currentDay” 我试图在附加的文本框中实现日期选择器:
<td>Recoupment Month
</td>
<td>Amount To be Recouped
</td>
<td>@Html.TextBoxFor(m => m.AMOUNT)
</td>
<td>@Html.TextBoxFor(m => m.DATE)
<input type="button" id="txt" value="ADD" style="",class="btn" />
<input type="button" id="Rmv" value="REMOVE" style="",class="btn" />
</td>
脚本 -
$。fn.rowCount = function(){return $('tr',$(this).find('tbody'))。length; };
$(document).on('click','#txt',function(){
var table = $(this).closest('#advschedule');
console.log(table.find('input:text').length);
if (table.find('input:text').length < 7) {
var x = $(this).closest('tr').nextAll('tr');
//$.each(x, function (i, val) {
// val.remove();
//});
table.append('<tr><td>@Html.TextBoxFor(m => m.DATE_SCHEDULED_RECOUP) </td><td>@Html.TextBoxFor(m => m.AMOUNT)</td>');
$.each(x, function (i, val) {
table.append(val);
});
}
});
$(document).on('click', '#Rmv', function () {
var table = $(this).closest('#advschedule');
var rowCount = $('#advschedule').rowCount();
if (rowCount > 2) {
table.find('input:text').last().closest('tr').remove();
}
});
});