Answers for "jquery select remove all options except selected"

3

remove all options from select jquery

$('#mySelect')
    .empty()
Posted by: Guest on March-18-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

Code answers related to "jquery select remove all options except selected"

Code answers related to "Javascript"

Browse Popular Code Answers by Language