javascript - select2 add option values on opening and refresh -
I have a select2 element that I need to add elements to when the user clicks on it. , I listen to the select2-opening event and add elements. ('Selection 2-Inauguration', function (avt) {$ ('# select2-elem'). APPEND ('& lt; Option value =' 1 "& gt; val1 ... & lt; / option & gt; ');});
This works fine (i.e. adds option to dome) except that I do not see the appended option immediately (Information) What is a way to refresh ?
Get a reference of current selection element using $ $) .
$ ('# select2_elem'). ('Select2-opening', function (evt) {$ (this) .append ('& lt; v Lp value = "1" & gt; Vale 1 ... & lt; / Options & gt; ');});
Comments
Post a Comment