Is there a way to change the plus sign to a minus sign in an expandable table view on click? (changing fa fa-plus
to fa fa-minus
) The goal is to have the plus sign displayed when the view is compressed and the minus sign displayed when it is expanded. If you have a solution, please share your code on this 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>