Horje
jquery select2 set value Code Example
jquery select2 set value
<select id="lang" >
   <option value="1">php</option>
   <option value="2">asp</option>
   <option value="3">java</option>
</select>

<script>
	$("#lang").select2().select2('val','1');
</script>
select2 tags set value jquery
$('#mySelect').select2({
  data: ['one','two'],
  tags: true
});
$('#mySelect').val(['one','two']).trigger('change')
get select2 selected value jquery
$('#id :selected').text();
select2 replace options
var options = [];
$.each(dataReturn, function (i, obj) {
    //console.log(i);
    //console.log(obj);
    options.push({
        text: obj.NickName,
        id: obj.NickName
    });
})
$("#BeneType").empty().select2({
    data: options
});
select2 dropdown with option to add new item
$('#select2')
    .select2()
    .on('select2:open', () => {
        $(".select2-results:not(:has(a))").append('<a rel="nofollow" href="#" style="padding: 6px;height: 20px;display: inline-table;">Create new item</a>');
})




Html

Related
excel formulas are being treated as text Code Example excel formulas are being treated as text Code Example
excel formulas are showing as text Code Example excel formulas are showing as text Code Example
multiplication sign in html\ Code Example multiplication sign in html\ Code Example
bootstrap hyperlink Code Example bootstrap hyperlink Code Example
html error page template Code Example html error page template Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8