jQuery(".xg_module_body .postbody a:last").addClass("continue");
Is there something wrong w/ that code? The class doesn’t get added for some reason.
I’m trying to add a link to just the last a in .postbody. I’ve tried :last-child and it adds a class to both a tags. So why wouldn’t :last work?
<div class="xg_module_body">
<h3>
<span>
<a href="link">
<img src="image url">
</a>
</span>
<a href="link">Lorem Ipsum</a>
</h3>
<div class="postbody">
<p>
<a href="link"><img src="image url"></a>
</p>
<p>Lorem Ipsum</p>
<a href="link">Continue</a>
</div>
<p class="small">
<a href="link">Lorem Ipsum</a>
</p>
<p>
<a href="link">Lorem Ipsum</a>
</p>
</div>
As seen here, it does work : http://jsfiddle.net/B9CwH/
I’m betting your selector is wrong. The snippet you pasted doesn’t have a
.xg_module_body