{"id":194,"date":"2008-08-23T19:19:00","date_gmt":"2008-08-23T19:19:00","guid":{"rendered":"http:\/\/blog.trungson.com\/?p=194"},"modified":"2008-08-23T19:19:00","modified_gmt":"2008-08-23T19:19:00","slug":"jquery-oddeven-selector-bug","status":"publish","type":"post","link":"http:\/\/blog.trungson.com\/?p=194","title":{"rendered":"jQuery odd\/even selector bug?"},"content":{"rendered":"<p>For some reason I have not been able to identify and test, this code would not work (show the same color or same color for subsequent rows, does not seem to have a pattern):<\/p>\n<pre>\n$(\"#tableid tbody tr:even\").addClass(\"even\");\n$(\"#tableid tbody tr:odd\").addClass(\"odd\");\n<\/pre>\n<p>But this does work:<\/p>\n<pre>\n$(\"#tableid tbody tr:nth-child(even)\").addClass(\"even\");\n$(\"#tableid tbody tr:nth-child(odd)\").addClass(\"odd\");\n<\/pre>\n<p>Any thought?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>For some reason I have not been able to identify and test, this code would not work (show the same color or same color for subsequent rows, does not seem to have a pattern): $(&#8220;#tableid tbody tr:even&#8221;).addClass(&#8220;even&#8221;); $(&#8220;#tableid tbody tr:odd&#8221;).addClass(&#8220;odd&#8221;); But this does work: $(&#8220;#tableid tbody tr:nth-child(even)&#8221;).addClass(&#8220;even&#8221;); $(&#8220;#tableid tbody tr:nth-child(odd)&#8221;).addClass(&#8220;odd&#8221;); Any thought?<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/194"}],"collection":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=194"}],"version-history":[{"count":0,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/194\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=194"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=194"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=194"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}