Forum

select2, dynamicall...
 
Powiadomienia
Wyczyść wszystko

select2, dynamically insert new value then select it

2 Wpisy
1 Użytkownicy
0 Reactions
1,807 Widoki
0
Rozpoczynający temat

how to? ajax, jquery

2 odpowiedzi
0
Rozpoczynający temat
1
2
var newOption = new Option("visible text",id_value, true, true);
$("#my_select").append(newOption).trigger('change');
var newOption = new Option("visible text",id_value, true, true);
$("#my_select").append(newOption).trigger('change');
0
Rozpoczynający temat

and try this

1
$("#asd").select2('destroy').empty().select2({data: [{id: 1, text: 'new text'}]});
$("#asd").select2('destroy').empty().select2({data: [{id: 1, text: 'new text'}]});

Twoja odpowiedź

Nazwa autora

E-mail autora

Twoje zapytanie *

 
Podgląd 0 rewizje Zapisano
Udostępnij: