How to select and deselect multiple check box with a button click in javascript
<p>In my project, i have multiple check box (total 27).I am trying to select all the check box with a single button click and  i am able to do it.But i want to deselect the same check box with the same button click.So the button should act like a selector and a de-selector.I can not use a check box instead of the button.
My html code is:</p>

<pre><code>&lt;div class="countryAll"&gt;
    &lt;span class="countrySelect_lngTrans_Translatable" title="Select All"&gt;
                &lt;input type="button" class="selectAllcountry" /&gt;
            &lt;/span&gt;
    &lt;span class="displayData"&gt;Select whole country&lt;/span&gt;
&lt;/div&gt;
</code></pre>

<p>In js:</p>

<pre><code>$(self.element).on('click', '.selectAllcountry', function(e) {
    debugger;
    $('.chkCountry').trigger('click')
    e.stopPropagation();
});
</code></pre>