Simulation : http://jsfiddle.net/frontenddeveloper/FZrp7/
1 2 3 4 5 6 7 8 9 |
jQuery(document).ready(function(){ // on applique une classe aux colonnes sélectionnées pour les mettre en avant visuellement jQuery('table input').click(function (){ var GET_COLUMN_INDEX = jQuery(this).closest('td').prevAll().length; jQuery('input').closest('table').find('th:nth-child(' + (GET_COLUMN_INDEX + 1) + '), td:nth-child(' + (GET_COLUMN_INDEX + 1) + ')').toggleClass('selected'); //alert( ' column # ' + ( GET_COLUMN_INDEX ) ); }); }); |