Home >Web Front-end >JS Tutorial >jQuery alternate display of row background color (alternate row color) implementation code_jquery

jQuery alternate display of row background color (alternate row color) implementation code_jquery

WBOY
WBOYOriginal
2016-05-16 18:39:331307browse

Some css definitions can be chosen according to your needs.
//Display single and double lines with different background colors [Method 1]:
// $("#UL_id li:even").attr("className","redClass");
// Display odd and double rows with different background colors [Method 2]:
$("#UL_id li:even").addClass("redClass");


  • Odd

  • Even number

  • Even number


odd: Single
even: Double
jQuery table changes color every other row Code

li improved version of alternate row color change

JS control table alternate row color change
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn