Using jQuery to check boxes based on user input (to another check box)
<p>This is a very simple use of jQuery that I can't get working.</p>

<p>When one check box is checked, I'd like the other to become checked.</p>

<p><strong>HTML:</strong></p>

<pre><code>&lt;input onchange="toggleRegion()" id="ESARO" type="checkbox" class="region"
value="ESARO" name="ESARO"&gt;ESARO

&lt;br /&gt;&lt;br /&gt;

&lt;input type="checkbox" class="country" value="Afghanistan" name="country2"
/&gt;Afghanistan
</code></pre>

<p><strong>jQuery:</strong></p>

<pre><code>function toggleRegion() {
    if ($('#ESARO').is(':checked')) {
        $('input[value="Afghanistan"]').attr('checked', true);
    }
}
</code></pre>

<p><strong>jsfiddle:</strong></p>

<p><a href="http://jsfiddle.net/jsJU8/" rel="nofollow">http://jsfiddle.net/jsJU8/</a></p>

<p><strong>What I've tried:</strong></p>

<p>I have another function which does a very similar thing for a group of check boxes by class which works perfectly:</p>

<pre><code>function toggleStatus() {
if ($('#TLO1').is(':checked')) {
        $('.country').attr('checked', true);

    } 
}
</code></pre>

<p>So I presume that the error lies in the selection of the element by value, rather than by class, as this is the only difference between the functions.</p>

<p>To this end I've tried adjusting that selector;'s syntax to match various examples I've found (single quote, double quote, no quote etc) but haven't had any luck.#</p>

<p>Although I note that it may be a possible error that I'm using javascript (onChange) to call a jQuery function. Is that an issue?</p>

<p>All help greatly appreciated - thank you</p>
