select2 / select2

Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.
https://select2.org/
MIT License
25.84k stars 6.27k forks source link

selection does not work #6226

Closed kisloid2001 closed 1 year ago

kisloid2001 commented 1 year ago

does not work: var rrr="['4','5']"; $('.select2').val(rrr).trigger('change');

ok: $('.select2').val(['4','5']).trigger('change');

how do I mark ?

rvcroffi commented 1 year ago

does not work: var rrr="['4','5']"; $('.select2').val(rrr).trigger('change');

Remove the double quotes: var rrr = ['4','5'];

kevin-brown commented 1 year ago

This appears to be more of a usage question than a bug report or common feature request. As we continue to keep the Select2 issue tracker geared towards these two areas, bug reports and common feature requests, we are redirecting usage questions to other communities such as the mailing list, IRC, or Stack Overflow.