How to enable/disable dropdownlist through a checkbox selection using Jquery
============Head Tag Of Page==================
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#chkbox").click(function () {
if (this.checked)
$('#ddlcountry').attr('disabled', 'disabled');
else
$('#ddlcountry').removeAttr('disabled'); });
});
</script>
==================Body Tage of Page=================
<asp:CheckBox ID="chkbox" runat="server" Text="Enable/Disable" />
<asp:DropDownList ID="ddlcountry" runat="server">
<asp:ListItem Text="Select" Value="India"/>
<asp:ListItem Text="Option1" Value="United States" />
<asp:ListItem Text="Option2" Value="China" />
<asp:ListItem Text="Option3" Value="Sri Lanka" />
</asp:DropDownList>
Comments
Post a Comment