Possible Duplicate:
Add table row in jQuery
I want to add a new row to my table on a change event. Here is what I have so far:
$('#CourseID').change(function() {
$('#CourseListTable > tr > td:last').append('<td>...</td>');
});
Here is my table:
<%@ 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>
I am not able to get this to work. I am missing something over here can anyone let me know where my error lies?
Thanks in advance.
thead
andtbody
sections to your table, you could just append the new row to the tbody... Also, I just realized you are appending a cell. Did you want to append a cell or a row? – MrOBrian Jul 18 '12 at 17:49