Answers for "select2 disabled"

3

select2 disable search

$("#js-example-basic-hide-search").select2({
    minimumResultsForSearch: Infinity
});
Posted by: Guest on November-14-2020
2

select2 search disable

$("#js-example-basic-hide-search").select2({
    minimumResultsForSearch: -1
});
Posted by: Guest on December-25-2020
0

disable other options in select except the selected

$("#lbCountries").click(function () {
     $("#lbCountires option").each(function (index) {
        if ($(this).is(':selected')) {
            $(this).prop('disabled', false);
         }
         else {
            $(this).prop('disabled', true);
         }
      });
  });
Posted by: Guest on December-23-2020
-1

select2 full width

<select class="js-example-responsive" style="width: 50%"></select>
<select class="js-example-responsive" multiple="multiple" style="width: 75%"></select>
Posted by: Guest on July-09-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language