I’m trying to trigger a .show on a div, when a link has a dynamically added class and it’s parent has the class pdSelectedSwatch which is added on selection(click).
example code:
<li class="pdSelectedSwatch">
<a href="javascript:void(0)" class="outOfStock">
<img class="outOfStock" src="/outofstock.gif" >
</a>
</li>
if ($("a.outOfStock").parent().hasClass("pdSelectedSwatch")) {
$(".stockMessage").show();
}
But I can’t get it to work properly, and I’m betting my syntax is off.
I should note that the outOfStock class is determined by values in an xml file, and there are several functions that determine the link’s class based on that file.
I should also note that the site is using jQuery 1.4.2, which won’t be updated at thsi time.
thanks.
can we have some of your html to make sure the selectors are right?
reponse to user edit