Enable/Disable a dropdownbox in jquery
Here is one way that I hope is easy to understand:
http://jsfiddle.net/tft4t/
$(document).ready(function() {
$("#chkdwn2").click(function() {
if ($(this).is(":checked")) {
$("#dropdown").prop("disabled", true);
} else {
$("#dropdown").prop("disabled", false);
}
});
});
I am using JQuery > 1.8 and this works for me...
$('#dropDownId').attr('disabled', true);
Try -
$('#chkdwn2').change(function(){
if($(this).is(':checked'))
$('#dropdown').removeAttr('disabled');
else
$('#dropdown').attr("disabled","disabled");
})
$("#chkdwn2").change(function(){
$("#dropdown").slideToggle();
});
JsFiddle
To enable/disable -
$("#chkdwn2").change(function() {
if (this.checked) $("#dropdown").prop("disabled",true);
else $("#dropdown").prop("disabled",false);
})
Demo - http://jsfiddle.net/tTX6E/