select2.js 548 B

123456789101112131415161718192021222324
  1. $(function(e) {
  2. "use strict";
  3. // Select2
  4. $('.select2').select2({
  5. minimumResultsForSearch: Infinity,
  6. width: '100%'
  7. });
  8. // Select2 by showing the search
  9. $('.select2-show-search').select2({
  10. minimumResultsForSearch: '',
  11. width: '100%'
  12. });
  13. // select2-search__field
  14. $('.select2').on('click', () => {
  15. let selectField = document.querySelectorAll('.select2-search__field')
  16. selectField.forEach((element, index) => {
  17. element.focus();
  18. })
  19. });
  20. });