【发布时间】:2017-12-29 04:29:02
【问题描述】:
我的要求如下:
我有一个默认行的表格,第一列有下拉菜单,一旦我从下拉菜单中选择一个选项,应该添加 1 个表格行,其内容与主行相同,并且应该为添加的行添加删除按钮。添加 1 行后,第 1 行的删除按钮不可见,然后只有第 1 行可见的删除按钮。请帮助我。 提前致谢。
我的代码如下
<table id="potable" class="table table-bordered table-striped dt-responsive nowrap" width="100%">
<thead>
<tr>
<th width="5%">Sr.no</th>
<th width="20%">Items</th>
<th>Description</th>
<th>Price</th>
<th>Qty</th>
<th>Unit</th>
<th>Amount</th>
<th>Tax</th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>
<select id="additems" name="additems" class="form-control" required="required">
<option selected>-- Select --</option>
<option><a href="" id="addnewpo">Add new</a></option>
<option value="1"> Abc </option>
<option value="2"> IT services </option>
<option value="3"> JS Enterprises</option>
</select>
</td>
<td>Dell 500 series</td>
<td>55,333</td>
<td>10</td>
<td>NA</td>
<td>5,53,330</td>
<td>8%</td>
<td width="2%"><a class="actions-btn" id="delete-row" title="Delete"><span class="icon ico-delete ico-2x"></span></a></td>
</tr>
</tbody>
</table>
【问题讨论】:
-
使用javascript。你用javascript做了什么?
-
我已经完成了通过 jquery 在按钮单击上添加行,但在 dropdwon 选择上没有。我想要它在下拉选择中。
-
请不要只对操作提出要求,因为您不付钱给这些人。请努力在操作上添加您尝试过的内容以及卡住的地方
-
我卡在 dropdwon 选择上的添加行
-
我不明白你到底想要什么!!!您想在每次用户在下拉列表中选择一个值时向表中添加一行??
标签: javascript jquery html css