Select2 disable/enable specific option
For Disable Try this:
$("#list>optgroup>option[value='1']").attr('disabled','disabled');
To remove Disable Try this:
$("#list>optgroup>option[value='1']").removeAttr('disabled');
$("#list").find(':selected').attr('disabled','disabled');
$("#list").trigger('change');
See Official Doc
https://select2.org/programmatic-control/retrieving-selections
Probably easiest way to achieve this, would be calling .select2(…)
on the element again after changing the disabled attribute.
http://jsfiddle.net/xoxd2u15/
Since select2 replaces the original select field with custom HTML elements (and hides the original), and apparently does not “watch” the options of that original select element for changes in their disabled state constantly after invocation, you have to call it once more after changing the state, so that it reads the current attribute values from the original element’s options.