jQuery.FilterTable Striping Sample

← More samples

This is a plain row striping sample of the jQuery.FilterTable plugin. It shows the code to stripe alternate rows.

Presidents of the United States of America

# President Terms Tenure
1George Washingtontwo1789-1797
2John Adamsone1797-1801
3Thomas Jeffersontwo1801-1809
4James Madisontwo1809-1817
5James Monroetwo1817-1825
6John Quincy Adamsone1825-1829
7Andrew Jacksontwo1829-1837
8Martin Van Burenone1837-1841
9William Henry Harrisonone-partial1841
10John Tylerone-partial1841-1845
11James Knox Polkone1845-1849
12Zachary Taylorone-partial1849-1850
13Millard Fillmoreone-partial1850-1853
14Franklin Pierceone1853-1857
15James Buchananone1857-1861
16Abraham Lincolntwo-partial1861-1865
17Andrew Johnsonone-partial1865-1869
18Ulysses S. Granttwo1869-1877
19Rutherford Birchard Hayesone1877-1881
20James Abram Garfieldone-partial1881
21Chester Alan Arthurone-partial1881-1885
22Grover Clevelandone1885-1889
23Benjamin Harrisonone1889-1893
24Grover Clevelandone-again1893-1897
25William McKinleytwo-partial1897-1901
26Theodore Roosevelttwo-partial1901-1909
27William Howard Taftone1909-1913
28Woodrow Wilsontwo1913-1921
29Warren Gamaliel Hardingtwo-partial1921-1923
30Calvin Coolidgetwo-partial1923-1929
31Herbert Clark Hooverone1929-1933
32Franklin Delano Rooseveltfour-partial1933-1945
33Harry S. Trumantwo-partial1945-1953
34Dwight David Eisenhowertwo1953-1961
35John Fitzgerald Kennedytwo-partial1961-1963
36Lyndon Baines Johnsontwo-partial1963-1969
37Richard Milhous Nixontwo-partial1969-1974
38Gerald Rudolph Fordtwo-partial1974-1977
39James Earl Carter, Jr.one1977-1981
40Ronald Wilson Reagantwo1981-1989
41George Herbert Walker Bushone1989-1993
42William Jefferson Clintontwo1993-2001
43George Walker Bushtwo2001-2009
44Barack Hussein Obamaone2009-

Data as of October, 2012.

Code

var stripeTable = function(table) { //stripe the table (jQuery selector)
    table.find('tr').removeClass('striped').filter(':visible:even').addClass('striped');
};
$('table').filterTable({
    callback: function(term, table) { stripeTable(table); } //call the striping after every change to the filter term
});
stripeTable($('table')); //stripe the table for the first time