title: How I can make a function to select a subset of a set of checkboxes?
body: <p>I have the following set of checkboxes:</p>
  
  <pre><code>&lt;ul class="checkbox_list"&gt;
   &lt;li&gt;&lt;input name="mensajes[receptores_list][]" type="checkbox" value="5" id="mensajes_receptores_list_5" /&gt;&lt;label for="mensajes_receptores_list_5"&gt;Carlos (Admin)&lt;/label&gt;&lt;/li&gt;
  &lt;li&gt;&lt;input name="mensajes[receptores_list][]" type="checkbox" value="1" id="mensajes_receptores_list_1" /&gt;&lt;label for="mensajes_receptores_list_1"&gt;Jorge (Admin)&lt;/label&gt;&lt;/li&gt;
  &lt;li&gt;&lt;input name="mensajes[receptores_list][]" type="checkbox" value="3" id="mensajes_receptores_list_3" /&gt;&lt;label for="mensajes_receptores_list_3"&gt;Marisa (Admin)&lt;/label&gt;&lt;/li&gt;
  &lt;li&gt;&lt;input name="mensajes[receptores_list][]" type="checkbox" value="6" id="mensajes_receptores_list_6" /&gt;&lt;label for="mensajes_receptores_list_6"&gt;Christian (Apuntes)&lt;/label&gt;&lt;/li&gt;
  &lt;li&gt;&lt;input name="mensajes[receptores_list][]" type="checkbox" value="4" id="mensajes_receptores_list_4" /&gt;&lt;label for="mensajes_receptores_list_4"&gt;Julieta (Contable)&lt;/label&gt;&lt;/li&gt;
  &lt;li&gt;&lt;input name="mensajes[receptores_list][]" type="checkbox" value="2" id="mensajes_receptores_list_2" /&gt;&lt;label for="mensajes_receptores_list_2"&gt;Vicky (Contable)&lt;/label&gt;&lt;/li&gt;
  &lt;/ul&gt; 
  </code></pre>
  
  <p>Using javascript or jquery, How I can make a function to checked/unchecked a subset of a set of checkboxes?</p>
  
  <p>For example: I want that when I press a button labeled, "Select only (Admin)", are checked/unchecked only "Carlos (Admin)" and "Marisa (Admin)" and "Jorge (Admin)" and when I press another button labeled "Select only (Contable)" are checked/unchecked only: “Julieta (Contable)” and “Vicky (Contable)”. Finally, a third button labeled "Select All" to enable checked/unchecked all checboxes.</p>
  
  <p>I have a new problem. I use the set of checkboxes as part of a form. When I click  the button "Submit" in the form, all the checkboxes are activated.
  How I can replace the four buttons "Admin", "Contable", "Apuntes" and "Select All" for four checkboxes with the same names and the same functions as the buttons?.</p>