I'm using the select2
jQuery plugin on a <select>
with multiple="multiple"
. I need to add values to the selected list (i.e. not to all the options, but to the selected options, without adding a new option).
I know I can set the selected options with this:
$("#the_select").select2("val", "the_option_value");
Or, for multiple selections:
$("#the_select").select2("val", ["an_option_value","another_option_value"]);
However, is there a way I can add selected options to the list (i.e. make an option selected) without removing the others?