Unable to set radio as checked and enclosing label as active using jQuery
<p>I have one set of radio buttons (greatly simplified from original HTML):</p>

<pre><code>&lt;form action="javascript:;" id="signup-form"&gt;
    &lt;div id="first"&gt;
        &lt;label class="custom-radio"&gt;
            &lt;input type="radio" name="delivery-mode" value="normal"&gt;
        &lt;/label&gt;
        &lt;label class="custom-radio"&gt;
            &lt;input type="radio" name="delivery-mode" value="scheduled"&gt;
        &lt;/label&gt;
    &lt;/div&gt;
&lt;/form&gt;
</code></pre>

<p>When I click on a radio button in the first set I want the corresponding radio button in the second set to also be checked.</p>

<pre><code>&lt;div id="second"&gt;
    &lt;label class="custom-radio"&gt;
        &lt;input type="radio" name="delivery-mode" value="normal"&gt;
    &lt;/label&gt;
    &lt;label class="custom-radio"&gt;
        &lt;input type="radio" name="delivery-mode" value="scheduled"&gt;
    &lt;/label&gt;
&lt;/div&gt;
</code></pre>

<p>I attempt to do this using this jQuery function:</p>

<pre><code>$('#first').on('click', '.custom-radio', function() {
    var selector;
    if ($this.find('[value="scheduled"]').is(':checked')) {
        selector = '[value="scheduled"]';
    } else {
        selector = '[value="normal"]';
    }
    var radio = $('#second').find(selector);
    var cRadio = radio.parent();
    cRadio.click();
    cRadio.addClass('active');
    radio.prop('checked', true);
});

$('#second').on('click', '.custom-radio', function() {
    //console.log('hello');
    var value = $(this).find('input').val();
    console.log(value);
});
</code></pre>

<p>I know I am finding correctly the corresponding radio label in the second set of radio buttons because the click works correctly.</p>

<p>However adding the 'active' class to the label does not work nor does setting the checked attribute of the radio button. I was able to do other things like modify the value of the radio button or change the class to something else other than 'active'. But for some reason I can't do these two things to indicate the radio button was checked.</p>

<p>What am I doing wrong? Please help. :-)</p>
