triggering jquery on dynamic elements
<p>I'm trying to trigger a <code>.show</code> on a div, when a link has a dynamically added class and it's parent has the class <code>pdSelectedSwatch</code>  which is added on selection(click).</p>

<p>example code:</p>

<pre><code>&lt;li class="pdSelectedSwatch"&gt;
   &lt;a href="javascript:void(0)" class="outOfStock"&gt;
      &lt;img class="outOfStock" src="/outofstock.gif" &gt; 
   &lt;/a&gt;
&lt;/li&gt;



if ($("a.outOfStock").parent().hasClass("pdSelectedSwatch")) {
    $(".stockMessage").show();
}
</code></pre>

<p>But I can't get it to work properly, and I'm betting my syntax is off.</p>

<p>I should note that the <code>outOfStock</code> class is determined by values in an xml file, and there are several functions that determine the link's class based on that file.</p>

<p>I should also note that the site is using jQuery 1.4.2, which won't be updated at thsi time.</p>

<p>thanks.</p>
