I have a table displayed in HTML which has two kinds of class
1 – alt
2 – SelectedrowData
initially the will have class “alt” when clicked the class will be changed to “SelectedrowData”. At the same time remaining whose class was “SelectedrowData” should to be retained to “alt”.
In simple words. When I click on a row the class name should be toggled. Same follows when I click on other rows. In fact in the whole table there will be only 1 “SelectedrowData”
My table is as below
<table>
<thead></thead>
<tbody>
<tr class="alt">
<td>72</td>
<td>SALES DEPT. SALES STAFF</td>
<td class="fieldHide">7018072</td>
<td class="fieldHide">7018572</td>
<td class="fieldHide">7018072</td>
<td class="fieldHide">7018072</td>
<td class="fieldHide">6</td>
<td class="fieldHide"></td>
<td>Default</td>
</tr>
<tr class="SelectedrowData">
<td>73</td>
<td>SALES DEPT. OFFICE ADMIN</td>
<td class="fieldHide">7018073</td>
<td class="fieldHide">7018573</td>
<td class="fieldHide">7018073</td>
<td class="fieldHide">7018073</td>
<td class="fieldHide">7</td>
<td class="fieldHide"></td>
<td>Default</td>
</tr>
<tr class="alt">
<td>72</td>
<td>SALES</td>
<td class="fieldHide">7018072</td>
<td class="fieldHide">7018572</td>
<td class="fieldHide">7018072</td>
<td class="fieldHide">7018072</td>
<td class="fieldHide">6</td>
<td class="fieldHide"></td>
<td>Default</td>
</tr>
</tbody>
</table>
1 Answer