<script src="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/js/tom-select.complete.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.bootstrap5.min.css" rel="stylesheet">
<script>
    window.addEventListener('load', () => {
        document.querySelectorAll('select').forEach((el) => {
            if (!el.classList.contains('tomselected')) {
                new TomSelect(el, {
                    create: false,
                    hideSelected: true,
                    maxOptions: null,
                    sortField: {
                        field: "text",
                        direction: "asc"
                    }
                });
            }
        });
    });
</script>
