我想一个新行添加到我的桌子上的改变事件。以下是我迄今为止:
$('#CourseID').change(function() {
$('#CourseListTable > tr > td:last').append('<td>...</td>');
});
这里是我的表:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<table id="CourseListTable">
<tr>
<th>Course ID</th>
<th>Course Section</th>
<th>Level</th>
</tr>
<tr>
<td><select name="CourseID" id="CourseID"></select></td>
<td><select name="CourseSection" id="CourseSection"></select></td>
<td><select name="Level" id="Level"></select></td>
</tr>
</table>
我不能得到这个工作。我错过了这里的任何东西,任何人都可以让我知道我的错误在哪里?
在此先感谢。
如果你添加'thead'和'tbody'部分到你的表中,你可以将新行添加到tbody中......另外,我只是意识到你正在追加一个单元格。你想追加一个单元格还是一行? – MrOBrian 2012-07-18 17:49:55