How do you add a class to an anchor if its parent has the class xyz
<p>How do you add a class to an anchor if its parent has the class xyz</p>

<p>I got so far...</p>

<pre><code>if($("a").parents(".xyz").length &gt; 0) {
addClass(".xyz")
};
</code></pre>

<p>obviously this isn't working otherwise I wouldn't be here asking :)</p>
