Hi Minesh, Thanks for your reply.
I have this in my page source:
<script>
function initTomSelects() {
document.querySelectorAll('.tom-select-init').forEach(function (select) {
if (!select.tomselect) {
new TomSelect(select, {
dropdownDirection: "top", // or "bottom" or "auto"
maxOptions: null, // remove limit completely
openOnFocus: true,
sortField: {
field: "text",
direction: "asc"
}
});
}
});
}
// Run on DOM load
document.addEventListener('DOMContentLoaded', function () {
initTomSelects();
});
// Re-run after Toolset AJAX updates
jQuery(document).on('js_event_wpv_parametric_search_results_updated', function () {
setTimeout(initTomSelects, 100); // optional delay for stability
});
</script>
and
<script type="text/javascript">
//-----------------------------------------
// View slug: search-by-complaint - start
//-----------------------------------------
function setupTomSelectWithBlur() {
document.querySelectorAll('.tom-select-init').forEach(function (el) {
if (!el.classList.contains('ts-initialized')) {
el.classList.add('ts-initialized');
const tom = new TomSelect(el, {
dropdownDirection: 'top'
});
tom.on('change', function () {
this.blur();
if (document.activeElement) {
document.activeElement.blur();
}
});
}
});
}
// Run at load
document.addEventListener('DOMContentLoaded', setupTomSelectWithBlur);
// Watch for Toolset redrawing filters
const observer = new MutationObserver(setupTomSelectWithBlur);
observer.observe(document.body, {
childList: true,
subtree: true
});
jQuery(document).ready(function(){
jQuery('ul.result-items li').each(function() {
var classNames = jQuery(this).attr("class");
jQuery('li.'+classNames).not(':first').hide();
});
});
//-----------------------------------------
// View slug: search-by-complaint - end
//-----------------------------------------
</script>
<script type="text/javascript">
//-----------------------------------------
// Content Template: home-page - start
//-----------------------------------------
// Remove Toolset's TomSelect initialization
document.addEventListener('DOMContentLoaded', function() {
// Override Toolset's functions with empty ones
if (typeof window.initTomSelects === 'function') {
window.initTomSelects = function() {};
}
if (typeof window.setupTomSelectWithBlur === 'function') {
window.setupTomSelectWithBlur = function() {};
}
// Remove any existing mutation observers
if (window.toolsetSelectObserver) {
window.toolsetSelectObserver.disconnect();
}
});
//-----------------------------------------
// Content Template: home-page - end
//-----------------------------------------
</script>
Generated by Toolset. How do I disable (or stop Toolset generating) this built-in TomSelect initialization.
Any help much appreciated