this is my .aspx page where i am using JQuery Based on the check box checked and uncheck i should make an div display and hide i here when i am displaying the div tag i am even reseting the dropdown values
but when ever i check/uncheck the checkbox nothing seems happening
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<%-- <script type="text/javascript">
<script type="text/javascript" src="JScript.js"></script>--%>
<script src="jquery-1.6.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{
if ($("#CheckBox1").is(':checked'))
{
$('#divControlGroup').css("display", "block");
$("#ddlcounty option:first").attr("selected", true);
}
else
{
$('#divControlGroup').css("display", "none");
}
})
</script>
</head>
<body>
<form id="form1" runat="server">
<table>
<tr>
<td>
<asp:CheckBox ID="CheckBox1" runat="server" Checked="false" />
</td>
<td>
<div id="divControlGroup" runat="server">
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:DropDownList ID="ddlcounty" runat="server">
<asp:ListItem Value="0">Select</asp:ListItem>
<asp:ListItem Value="1">India</asp:ListItem>
<asp:ListItem Value="2">US</asp:ListItem>
<asp:ListItem Value="3">UK</asp:ListItem>
</asp:DropDownList>
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
pls let me know where i amgoing where, any help would be great
Thanks
finally anser for the problem
<script type="text/javascript">
$(document).ready(function()
{
$('#<%= CheckBox1.ClientID %>').change(function()
{
if($(this).is(':checked'))
{
$("#divControlGroup").css("display", "block");
$("#ddlcounty option:first").attr("selected", true);
}
else
{
$("#divControlGroup").css("display", "none");
}
})
});
</script>