Please I need help I have been looking for 4 hours.How can I do this : when the user clicks on one of the lines of the , an “EventListener” must call a function which takes care of modifying the background color of the line concerned. I have to do this in Javascript without including styles directly in the JavaScript code. I had a color in my css file with a class name .select . I will add my html code here to help. The table is in a php file because it is in a php session (that's why there is php in the html). In the php file theres nothing except the information in the table and code for the php session.
HTML:
<table id="tbl_carnet" class="terne">
<thead id="tbl_carnet_entete">
<tr class="lignes_titres">
<th class="entete_nom">Nom</th>
<th class="entete_bureau">Bureau</th>
<th class="entete_telephone">Téléphone</th>
<th class="entete_extension">Extension</th>
<th class="entete_courriel">Courriel</th>
</tr>
</thead>
<tbody id="tbl_carnet_corps">
<?php
for ($i = 0; $i < count($contacts); $i++) {
echo '<tr class="lignes_corps" id="ligne_' . $i . '">';
foreach ($contacts[$i] as $typeInfo => $infoContact)
echo '<td class="' . $typeInfo . '">' . $infoContact . '</td>';
echo '</tr>';
}
?>
</tbody>
<tfoot id="tbl_carnet_pied">
<tr class="lignes_pied">
<td colspan="6">Dernière mise à jour : mai 2022</td>
</tr>
</tfoot>
</table>