<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	>
<channel>
	<title>Comments on: jQuery Table Striping Bug</title>
	<atom:link href="http://trevordavis.net/blog/tutorial/jquery-table-striping-bug/feed/" rel="self" type="application/rss+xml" />
	<link>http://trevordavis.net/blog/tutorial/jquery-table-striping-bug/</link>
	<description>Doing That Web Standards Thing</description>
	<pubDate>Wed, 07 Jan 2009 11:41:53 +0000</pubDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Trevor</title>
		<link>http://trevordavis.net/blog/tutorial/jquery-table-striping-bug/comment-page-1/#comment-941</link>
		<dc:creator>Trevor</dc:creator>
		<pubDate>Wed, 18 Jun 2008 17:07:30 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=237#comment-941</guid>
		<description>@Andy and Pete-
I see what you are saying. But with that, wouldn&#8217;t the nth-child selector work the same way?</description>
		<content:encoded><![CDATA[<p>@Andy and Pete-<br />
I see what you are saying. But with that, wouldn&rsquo;t the nth-child selector work the same way?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pete</title>
		<link>http://trevordavis.net/blog/tutorial/jquery-table-striping-bug/comment-page-1/#comment-939</link>
		<dc:creator>Pete</dc:creator>
		<pubDate>Wed, 18 Jun 2008 16:56:13 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=237#comment-939</guid>
		<description>Nice post, but Andy is right.  I tried his changes on your tables, and they work like a charm.  Sometimes the obvious isn't so obvious, and I keep stumbling upon dozens of ways to do similar things in jQuery.

Keep up the good work!</description>
		<content:encoded><![CDATA[<p>Nice post, but Andy is right.  I tried his changes on your tables, and they work like a charm.  Sometimes the obvious isn&#8217;t so obvious, and I keep stumbling upon dozens of ways to do similar things in jQuery.</p>
<p>Keep up the good work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Couch</title>
		<link>http://trevordavis.net/blog/tutorial/jquery-table-striping-bug/comment-page-1/#comment-938</link>
		<dc:creator>Andy Couch</dc:creator>
		<pubDate>Wed, 18 Jun 2008 14:55:43 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=237#comment-938</guid>
		<description>I don't think this is a jQuery bug.  In fact, I would consider this a feature.  In your selector, you are telling jQuery to collect all TRs that are inside TABLEs with the "striped" class that appear in the document and then differentiate between the even and odd ones.   You aren't telling jQuery to reset the counter when it encounters a new table.   While this might seem like something that should happen automatically, there are many use cases where you wouldn't want that to happen.  I think this is all just part of the power of jQuery.   So the easy fix is to just group each table into its own collection, which gives each on its own index.   And you could do that with something like this...

$(document).ready(function(){
  $("table.striped").each(function(){
    $(this).find("tbody tr:odd").addClass("odd");
    $(this).find("tbody tr:even").addClass("even");
  });
});

I'm not saying your solution is wrong.  This is just another solution that would work too.  There are probably a 100 other ways to do it as well.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think this is a jQuery bug.  In fact, I would consider this a feature.  In your selector, you are telling jQuery to collect all TRs that are inside TABLEs with the &#8220;striped&#8221; class that appear in the document and then differentiate between the even and odd ones.   You aren&#8217;t telling jQuery to reset the counter when it encounters a new table.   While this might seem like something that should happen automatically, there are many use cases where you wouldn&#8217;t want that to happen.  I think this is all just part of the power of jQuery.   So the easy fix is to just group each table into its own collection, which gives each on its own index.   And you could do that with something like this&#8230;</p>
<p>$(document).ready(function(){<br />
  $(&#8220;table.striped&#8221;).each(function(){<br />
    $(this).find(&#8220;tbody tr:odd&#8221;).addClass(&#8220;odd&#8221;);<br />
    $(this).find(&#8220;tbody tr:even&#8221;).addClass(&#8220;even&#8221;);<br />
  });<br />
});</p>
<p>I&#8217;m not saying your solution is wrong.  This is just another solution that would work too.  There are probably a 100 other ways to do it as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fwolf</title>
		<link>http://trevordavis.net/blog/tutorial/jquery-table-striping-bug/comment-page-1/#comment-937</link>
		<dc:creator>fwolf</dc:creator>
		<pubDate>Wed, 18 Jun 2008 11:36:18 +0000</pubDate>
		<guid isPermaLink="false">http://trevordavis.net/?p=237#comment-937</guid>
		<description>so basically the counter is not being reset when performing yet another "table striping"-session, aint it?

I havent looked into the source yet, but normally you would create a oddeven-chooser-function like this, ie. using a row counter and then % 2 (true = odd, false = even).

cu, w0lf.</description>
		<content:encoded><![CDATA[<p>so basically the counter is not being reset when performing yet another &#8220;table striping&#8221;-session, aint it?</p>
<p>I havent looked into the source yet, but normally you would create a oddeven-chooser-function like this, ie. using a row counter and then % 2 (true = odd, false = even).</p>
<p>cu, w0lf.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
