【发布时间】:2017-06-19 02:53:25
【问题描述】:
我想在运行时使用 Jquery 动态添加行。在开始表没有任何记录。当用户单击ADD Button 时,它必须添加行。
当用户单击添加按钮时,运算符下拉列表框值和过滤器值应添加到该表行中。
这是我尝试过的 jQuery 代码
$("#btnAdd").click(function () {
// $("#queryTable tr:last").after("<tr>...</tr><tr>...</tr>");
$('#queryTable > tbody:last-child').append('<tr>Record1</tr><tr>Record2</tr>');
});
我尝试了两条线路。但这没有任何意义。 谢谢
HTML 代码
<table class="table table-hover " id="queryTable">
<thead>
<tr>
<th>Field Name</th>
<th>Values</th>
</tr>
</thead>
<tbody>
<tr>
<td>Mark</td> //Please ignore these two records. At beginning the table will be empty
<td>Otto</td>
</tr>
<tr>
<td>Jacob</td>
<td>Thornton</td>
</tr>
</tbody>
</table>
【问题讨论】:
-
@locateganesh, How does accepting an answer work?
标签: javascript jquery html asp.net