xn dx
xn dx

Reputation: 793

Hide all table rows after a specific number?

I'd like to write some code where it displays a complete listing for a year, but initially only show the first 6 weeks (so, 42 days) and then you can click a button to view the rest (no need for a toggle).

I was going to do this using PHP, and setting a class on each of the ones I'd want to hide, which is fine, I guess, I just wasn't sure if there was a more efficient way of doing it in jQuery.

Upvotes: 6

Views: 4565

Answers (2)

karim79
karim79

Reputation: 342665

$("table tr:gt(5)").hide();

will hide all of them after/greater than the sixth row.

Upvotes: 15

Zoltan Toth
Zoltan Toth

Reputation: 47677

slice() - http://api.jquery.com/slice/

Upvotes: 3

Related Questions