Files
silent-auction/resources/views/components/tomselect.blade.php
T

25 lines
926 B
PHP

<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">
<style>
.ts-control { background-color: #ffffff !important; border: 1px solid #ced4da !important; }
</style>
<script>
(function() {
const init = () => {
document.querySelectorAll('select').forEach((el) => {
if (el.tomselect) return;
new TomSelect(el, {
create: false,
sortField: { field: 'text', direction: 'asc' }
});
});
};
// Use a single listener to prevent multiple triggers
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', init);
} else {
init();
}
})();
</script>