aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Generalized table striping using JQuery Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Generalized table striping using JQuery" Watch "Generalized table striping using JQuery" New topic
Author

Generalized table striping using JQuery

Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24061
    
  13

Is there a way to generalize this kind of JQuery trick:



to add a class to, say, every third or fourth row of a table, rather than every second row?


[Jess in Action][AskingGoodQuestions]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56233
    
  13

Have you considered the nth-child:Xn+Y form of selector?


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24061
    
  13

Thanks, Bear, that works perfectly -- I had no idea such a thing was in there.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56233
    
  13

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15357
    
    6
With CSS3 enabled browsers, you do not even need to use jQuery. That would be a big performance gain.



Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56233
    
  13

Unfortunately, not everyone is using modern browsers. Microsoft keeps threatening to instill auto-upgrades a la Chrome and Firefox, but it hasn't happened yet.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Generalized table striping using JQuery
 
Similar Threads
Prototype tableID in function
JQuery vs Dojo
Trying out jquery, but things are not working out
jQuery in Action - is jQuery an abstraction
Change the background color of a row in a table upon mouse click