debug: add verbose logging to tomselect init

This commit is contained in:
2026-05-01 12:58:18 -04:00
parent 762b242046
commit 1f4b108c51
+12 -6
View File
@@ -1,17 +1,23 @@
<script src="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/js/tom-select.complete.min.js"></script> <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"> <link href="https://cdn.jsdelivr.net/npm/tom-select@2.4.3/dist/css/tom-select.bootstrap5.min.css" rel="stylesheet">
<script> <script>
window.addEventListener('load', () => { document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('select').forEach((el) => { console.log('DOM fully loaded, searching for selects...');
if (!el.classList.contains('ts-hidden-accessible')) { const selects = document.querySelectorAll('select');
console.log('Initializing TomSelect on:', el); console.log('Found ' + selects.length + ' select elements.');
selects.forEach((el) => {
console.log('Attaching TomSelect to:', el);
try {
new TomSelect(el, { new TomSelect(el, {
create: false, create: false,
sortField: { sortField: {
field: "text", field: 'text',
direction: "asc" direction: 'asc'
} }
}); });
} catch (e) {
console.error('TomSelect failed for:', el, e);
} }
}); });
}); });