yzt
2023-05-26 de4278af2fd46705a40bac58ec01122db6b7f3d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$(".basic").select2({
    tags: true,
});
 
var formSmall = $(".form-small").select2({ tags: true });
formSmall.data('select2').$container.addClass('form-control-sm')
 
$(".nested").select2({
    tags: true
});
$(".tagging").select2({
    tags: true
});
$(".disabled-results").select2();
$(".placeholder").select2({
    placeholder: "Make a Selection",
    allowClear: true
});
 
function formatState (state) {
  if (!state.id) {
    return state.text;
  }
  var baseClass = "flaticon-";
  var $state = $(
    '<span><i class="' + baseClass + state.element.value.toLowerCase() + '" /> ' + state.text + '</i> </span>'
  );
  return $state;
};
 
$(".templating").select2({
  templateSelection: formatState
});