I created a table in my application, the same as the code
<table class="spreadsheet"> <tr> <td>1</td> <td>2</td> </tr> <tr> <td>3</td> <td>4</td> </tr> <tr> <td>5</td> <td>6</td> </tr> </table>
I select a row with a click with the following jQuery code
$("tr").click(function(){ $(this).toggleClass("otherstyle"); }
and my css
tr.otherstyle td { background-color: #d1db3e; color:#000; }
I would like when I click on a row, no other rows are selected and only one row is selected.
How could we create this?
source share