Reputation: 187
I have a drop down, in that I have first option "Select All" and other options. So if I select "Select All", I want to disable all other options, but as soon as I remove "Select All" option then all other options should be selectable.
Upvotes: 0
Views: 51
Reputation: 1266
you need this code
$('#mydropdwon').change(function(){
if($('#mydropdwon').val() == "Select All"){
$(".myoptins").not($(".all")).prop('disabled', function(i, a) { return !a; });
}
});
Working solution here
Please let me know if it helps.
But I would recommend you to have move select All out of drop down, you can enable/disable dropdown based on that checkbox, just for intuitiveness.
Upvotes: 3