【发布时间】:2015-12-02 20:12:43
【问题描述】:
我有一张可展开视图的表格。单击加号它会扩展,但我希望在视图处于展开形式时将加号更改为减号(fa fa-plus to fa fa-minus),并在视图处于压缩形式时返回加号,谁能告诉我该怎么做所以(代码@fiddle)
<script>
$(document).ready(function(){
$("#report tbody tr:odd td:first-child").click(function(){
$this=$(this);
$this.parent().next("tr").toggle();
$this.find(".arrow").toggleClass("up");
});
});
</script>
<table id="report" border="1" style="width:100%" >
<tr>
<th> First </th>
<th> Second </th>
<th> Third </th>
</tr>
<tr>
<td><i class="fa fa-plus"></i></td>
<td>1</td>
<td>1</td>
</tr>
<tr>
<td colspan="10">
dummy text 1<br>
dummy text 1<br>
dummy text 1<br>
</td>
</tr>
</table>
【问题讨论】:
-
如果这对您有用,请告诉我,以便我发布答案。
标签: javascript jquery css