 <p>You can try to use <a href="http://api.jquery.com/multiple-attribute-selector/" rel="nofollow">multiple attribute</a> selector:</p> <pre><code>$('tr[:nth-child(odd)][id^="part"]').addClass("alt"); </code></pre>