Created
May 12, 2011 15:53
-
-
Save corydorning/968810 to your computer and use it in GitHub Desktop.
Simple jQuery table striping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* jQuery Table Striping - v0.1 - 05/12/2011 | |
* http://corydorning.com, http://justinrains.com | |
* | |
* Dual licensed under 'Use it like you stole it' | |
* and 'We Don't Care'. | |
* | |
* Description: Stripe table rows easily by calling 'stripeRows' | |
* on any collection of <tr> elements and passing in the desired | |
* colors. | |
* | |
* Example usage: | |
* $('tr').stripeRows('#eee', '#ccc'); | |
* | |
*/ | |
$.fn.stripeRows = function(e,o) { | |
return this | |
.filter(':even') | |
.css('background-color', e) | |
.end() | |
.filter(':odd') | |
.css('background-color', o); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment