Select odd even child excluding the hidden child

后端 未结 9 1409
暖寄归人
暖寄归人 2020-12-01 23:30

Line 3 is a hidden

. I don\'t want that one to be taken from the odd/even css rule.

What is the best approach to get t

9条回答
  •  没有蜡笔的小新
    2020-12-02 00:15

    Hide the rows you want to hide calling .hide() for each table row, then call

    $("tr:visible:even").css( "background-color", "" ); // clear attribute for all rows
    
    $("tr:visible:even").css( "background-color", "#ffffddff" ); // set attribute for even rows
    

    Add your table name to the selector to be more specific. Using :even makes it skip the Header row.

提交回复
热议问题