Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

315
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!