我在 java 脚本中有一个“添加行”功能。如何将添加的行数限制为不超过 10 行?这是我的代码。谢谢您的帮助!
$(document).on('click', '#addAddOnDay', function() {
var rowCount = $('#addOnDay tr').length + 1;
var rowClass = (rowCount % 2 != 0) ? 'rowOdd' : 'rowEven';
$('#addOnDay').append('<tr class="'+ rowClass +'"> \
<td align="center"><input type="text" class="text" style="width: 99%;" /></td> \
<td align="center"><input type="radio" name="4a_1"> <label>Yes</label> <input type="radio" name="4a_1" checked> <label>No</label></td> \
<td align="center">20000 or 95%</td> \
<td align="center" class="rollUpDisplay">1</td> \
</tr>');
});