I have CheckBoxList
when I have one default value called "Select All" and rest items binded from database:
<asp:CheckBoxList runat="server" ID="chkBxLstSystemTypes" CssClass="chkBxList" RepeatDirection="Horizontal" RepeatColumns="10" TabIndex="2">
<asp:ListItem Value="SelectAll">Select All</asp:ListItem>
I would like to have JavaScript or jQuery function which will check all check boxes when user clicks "Select all" and deselect the check boxes when user deselects the "Select All".
-- EDIT 1 Rendered HTML:
<table id="ctl00_MainContent_chkBxLstSystemTypes" class="chkBxList" border="0">
<tr>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_0" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$0" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_0">Select All</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_1" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$1" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_1">ASG</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_2" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$2" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_2">AVP</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_3" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$3" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_3">CDR</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_4" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$4" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_4">CMS</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_5" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$5" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_5">CUCM_Logins</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_6" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$6" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_6">CUCM_Subscribers</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_7" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$7" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_7">Cybertech</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_8" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$8" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_8">eHealth</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_9" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$9" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_9">Intuity</label>
</td>
</tr>
<tr>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_10" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$10" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_10">MMSMailbox</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_11" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$11" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_11">MMSUser</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_12" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$12" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_12">NICE Perform</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_13" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$13" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_13">PBX</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_14" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$14" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_14">UNITY</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_15" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$15" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_15">VoIP</label>
</td>
<td>
<input id="ctl00_MainContent_chkBxLstSystemTypes_16" type="checkbox" name="ctl00$MainContent$chkBxLstSystemTypes$16" tabindex="2" />
<label for="ctl00_MainContent_chkBxLstSystemTypes_16">WebEx</label>
</td>
<td></td>
<td></td>
<td></td>
</tr>
</table>