forked from TFMM/silent-auction
fix: prevent double initialization of tomselect and update style
This commit is contained in:
@@ -3,8 +3,15 @@
|
|||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
document.querySelectorAll('select').forEach((el) => {
|
document.querySelectorAll('select').forEach((el) => {
|
||||||
|
// Check if Tom Select is already initialized
|
||||||
|
if (el.tomselect) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
new TomSelect(el, {
|
new TomSelect(el, {
|
||||||
create: false,
|
create: false,
|
||||||
|
hideSelected: true,
|
||||||
|
maxOptions: null,
|
||||||
sortField: {
|
sortField: {
|
||||||
field: 'text',
|
field: 'text',
|
||||||
direction: 'asc'
|
direction: 'asc'
|
||||||
|
|||||||
Reference in New Issue
Block a user