I\'m using jQuery select2 multi select dropdown. I need to select all options in a dropdown from code. Basically there is a Select All checkbox on which this functionality h
Update 2019
To programmatically select an option/item for a Select2 control, use the jQuery .val() method.
You can also pass an array to val make multiple selections:
$('#mySelect2').val(['1', '2']);
$('#mySelect2').trigger('change');
https://select2.org/programmatic-control/add-select-clear-items#selecting-options