Je vois cet article sur highlighting even columns mais puis-je mettre en surbrillance uniquement les colonnes sélectionnées?jQuery ne mettant en évidence les colonnes sélectionnées que dans un tableau
Voici le code qu'ils utilisent:
$("table.Table22 > tbody > tr > td:nth-child(even)").css("background","blue");
Mais je voudrais: NOTE: le class="highlight"
sera sur les colonnes sélectionnées, donc si je choisi la colonne 3 du class="highlight"
seraient retirés de la colonne 2 et ajouté à la colonne 3. jQuery doit ajouter la classe en fonction de la colonne sélectionnée.
<table class="tbl">
<tr>
<th class="firstColumn">
Cell 1:Heading
</th>
<th class="highlight">
Selected column so this should be highlighted
</th>
<th>
Cell 3:Heading
</th>
<th>
Cell 4:Heading
</th>
<th>
Cell 5:Heading
</th>
</tr>
<tr>
<td>
Cell 1:Row 1
</td>
<td class="highlight">
Selected column so this should be highlighted
</td>
<td>
Cell 3:Row 1
</td>
<td>
Cell 4:Row 1
</td>
<td>
Cell 5:Row 1
</td>
</tr>
<tr>
<td>
Cell 1:Row 2
</td>
<td class="highlight">
Selected column so this should be highlighted
</td>
<td>
Cell 3:Row 2
</td>
<td>
Cell 4:Row 2
</td>
<td>
Cell 5:Row 2
</td>
</tr>
</table>
J'ai aimé le plugin tableHover mais en fait je cherche à changer le CSS dans les colonnes sélectionnées d'une table, mais je pense que pour l'exemple je voudrais juste utilisez la surbrillance. Mais le plugin ira dans mon espace de travail très bientôt, Merci :) –
Merci c'est ce dont j'avais besoin. Y a-t-il une chance que tu puisses aider sur mon autre question? J'ai aussi ajouté votre code: http://stackoverflow.com/questions/1126489/jquery-examples-horizontal-accordion-table-instead-of-un-ordered-lists-upda –
Le plugin fonctionne bien, mais les colspans ne sont pas supportés - cela compliquerait par –