Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

312
Visualizações
How can i select a row and change the background-color on the select row

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>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda