I've never really had an issue with JS in the past, but for some reason I can't seem to get some quite simple working!
In a nutshell, I have some radio buttons, and they're contained in DD tags a few levels back. I'm trying to style the DD tags depending on whether the radio button is selected or not.
Here is my HTML:
<dl class="sp-methods">
<dd>
<ul>
<li>
<input name="shipping_method" type="radio" value="freeshipping_freeshipping" id="s_method_freeshipping_freeshipping" checked="checked" class="radio">
<label for="s_method_freeshipping_freeshipping"></label>
<p class="shipping_method">Walk-In</p>
<span class="price">£0.00</span>
</li>
</ul>
</dd>
</dl>
The JS i'm trying to use is:
$('input').change(function () {
if ($('dd ul li').find(':checked')) {
$(this).parent().parent().addClass('selected');
}
});
But when looking at the Inspector, the class doesn't seem to be adding at all. There are no errors regarding this bit of JS so i'm assumig it's being called okay.
It can be viewed at www.asg.co.uk/gadgetclinic (it's in the Checkout area with the two buttons saying Walk-in and Post area)