1$ = jQuery 2 3$(document).ready(function () { 4 // Function to filter the countries list 5 function filterCountries() { 6 let query = $('#select-country-component .search .input input').val().toLowerCase(); // Get the search query 7 const svg = $('#select-country-component .search .input .svg'); 8 9 if (query.length) { 10 svg.empty() 11 svg.append(icons.close) 12 svg.addClass('close-icon') 13 } else { 14 svg.empty() 15 svg.removeClass('close-icon') 16 svg.append(icons.search) 17 } 18 19 $('#select-country-component .countries-wrapper .country').each(function () { 20 let countryName = $(this).data('country').toLowerCase(); // Get the country name 21 if (countryName.includes(query)) { 22 $(this).show(); // Show countries that match the query 23 } else { 24 $(this).hide(); // Hide countries that do not match 25 } 26 }); 27 } 28 29 // Event listener for search input keyup 30 $('#select-country-component .search .input input').on('keyup', function () { 31 filterCountries(); 32 }); 33 34 // Optional: Clear the search input and reset the list 35 $('#select-country-component .search .input .svg').on('click', function () { 36 if ($(this).hasClass('close-icon')) { 37 $('#select-country-component .search .input input').val(''); // Clear the input 38 filterCountries(); // Reset the list 39 } 40 }); 41});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.