Greeting.
How to enable or disable asp.net DropDownList control using jquery when checking an asp.net checkbox.
So I have I have an asp.net checkbox when I check it I want to enable/disable a DropDownList.
Thank you,
Something like this could do the magic
$('#<%= CheckBox1.ClientID %>').click(function(){
if ($('#<%= DropDownList2.ClientID %>').prop('disabled') != true)
$('#<%= DropDownList2.ClientID %>').prop('disabled', true);
else
$('#<%= DropDownList2.ClientID %>').prop('disabled', false);
})
$("#'<%=CheckBoxId.ClientID %>'").click(function(){
if( $("#'<%=CheckBoxId.ClientID %>'").attr('checked'))
$("#'<%=DropDownListID.ClientID %>'").attr('disabled', true);
else
$("#'<%=DropDownListID.ClientID %>'").attr('disabled', false);
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With