Created
October 21, 2010 12:47
-
-
Save Takazudo/638415 to your computer and use it in GitHub Desktop.
$.fn.zebraTable
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
/** | |
* $.fn.zebraTable | |
* $(anyTableElement).zebraTable() will attach 'odd' or 'even' to each trs. | |
*/ | |
$.fn.zebraTable = function(){ | |
return this.each(function(){ | |
var $el = $(this); | |
var $tbody = $('tbody', $el); | |
$el = $tbody.size() ? $tbody : $el; | |
$('tr:odd', $el).addClass('odd'); | |
$('tr:even', $el).addClass('even'); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment