how to use select2 code example

Example 1: select2

$('.js-example-basic-single').select2({
  placeholder: 'Select an option'
});

Example 2: select 2 multiselect

//Installation
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>



// In your Javascript (external .js resource or <script> tag)
$(document).ready(function() {
    $('.js-example-basic-single').select2();
});

Example 3: select2

$(".js-example-basic-multiple-limit").select2({
  maximumSelectionLength: 3
});

Example 4: select2 .select2-results .select2-highlighted

$(document).ready(function() {
    $("#menuOption1").select2({dropdownParent: "#menuOption1-container"});
    $("#menuOption2").select2({dropdownParent: "#menuOption2-container"});
});