$(document).ready(function () { $('#size_id').select2({ placeholder: 'Select a size', // Add a placeholder if needed allowClear: true, // Optional: allows clearing the selection });
// Add an event listener for the "open" event
$('#size_id').on('select2:open', function () {
// Target the search input field in Select2 and focus on it
document.querySelector('.select2-search__field').focus();
});
});
Replacfe your search Id with the "size_id" , cheers !!!