Comment coloriser des colonnes de table paires (ou impaires) en utilisant jQuery? (sans ajout de classes manuellement)jQuery: mettre en surbrillance des colonnes paires (pas des lignes)
Mon balisage est:
<table>
<caption>Table caption</caption>
<thead>
<tr><th scope="col">Table header 1</th><th scope="col">Table header 2</th><th scope="col">Table header 3</th><th scope="col">Table header 3</th></tr>
</thead>
<tbody>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
</tbody>
</table>
(il peut ou ne peut pas contenir attribs scope ou th
tags)
+1: Merci pour votre commentaire dans ma réponse et de fournir la bonne solution ici. – Sarfraz
Merci, celui-ci fonctionne bien (la version précédente a fait une sorte de dames;) – Adrian
Besoin de plus de rep pour upvote :) – Adrian