Show/Hide based on checkbox checked/unchecked

uunf2xan

New Member
I have 5 checkboxes. 4 of them have to show/hide based on whether the 5th is checked/unchecked. I'm trying to do this using JQuery, however I'm not quite getting it right for some reason. I'm hitting the sections of code that check the checked/unchecked property correctly, just not getting the actual show/hide code correct. I have tried it using a CSS Class for the checkboxes I need to toggle. Here's the JQuery and .aspx code\[code\]$(function () { $('#<%=chkFrench.ClientID %>').unbind('click'); $('#<%=chkFrench.ClientID %>').click(function () { enable_cb(); $(".EnhancedFrench").click(enable_cb); }); }); function enable_cb() { if (this.checked) { alert("show"); $('.EnhancedFrench').show(); } else { alert("hide"); $('.EnhancedFrench').hide(); } } <table> <tr> <td>Display Live (Fr):</td> <td><asp:CheckBox runat="server" ID="chkFrench" CssClass="EnhancedFrench" />/td> </tr> <tr> <td>French1</td> <td><asp:CheckBox runat="server" ID="CheckBox1" CssClass="EnhancedFrench" /></td> </tr> <tr> <td>French2</td> <td><asp:CheckBox runat="server" ID="CheckBox2" CssClass="EnhancedFrench" /></td> <tr> <tr> <td>French3</td> <td><asp:CheckBox runat="server" ID="CheckBox3" CssClass="EnhancedFrench" /></td> </tr> <tr> <td>French4</td> <td><asp:CheckBox runat="server" ID="CheckBox4" CssClass="EnhancedFrench" /></td> </tr> </table>\[/code\]
 
Back
Top