lundi 20 juin 2016

Check if All check box in Panel1 are checked to show a Panel2

I have 2 panels, of checkbox: In Panel1, if all checkbox are checked I need to show Panel2. I have a HTML and a script but it's not working, I think that I'm missing somthing. here is my code :

<body>
<asp:Panel ID="Panel1" runat="server">
    <table>
        <tr>
            <td>
                <asp:Label ID="Title" runat="server" Text="Enter the Title"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Question1" runat="server" Text="Question1"></asp:Label>
            </td>
            <td>
                <asp:CheckBox ID="CheckBox1" runat="server" Checked="false" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Question2" runat="server" Text="Question2"></asp:Label>
            </td>
            <td>
                <asp:CheckBox ID="CheckBox2" runat="server" Checked="false" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Question3" runat="server" Text="Question3"></asp:Label>
            </td>
            <td>
                <asp:CheckBox ID="CheckBox3" runat="server" Checked="false" />
            </td>
        </tr>
    </table>
</asp:Panel>
<asp:Panel ID="Panel2" runat="server">
    <table>
        <tr>
            <td>
                <asp:Label ID="Question4" runat="server" Text="Question4"></asp:Label>
            </td>
            <td>
                <asp:CheckBox ID="CheckBox4" runat="server" Checked="false" />
            </td>
        </tr>
    </table>
</asp:Panel>
<table>
    <tr>
        <td>
            <asp:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />
        </td>
    </tr>
</table>

And this is my script but it's not working

$(document).ready(function () { 
$('#CheckBox1').removeAttr('checked');
$('#CheckBox2').removeAttr('checked');
$('#CheckBox3').removeAttr('checked');
$('#CheckBox4').removeAttr('checked');  
$('#Panel2').hide(); 
$('#Panel1').change(function () { 
if (this.checked) { 
$('#Panel2').show(); 
} 
else { 
$('#Panel2').hide(); 
} 
}); 
});

Help please




Aucun commentaire:

Enregistrer un commentaire