diff --git a/templates/tb-megamenu.html.twig b/templates/tb-megamenu.html.twig
index 76f87d9..6fdd522 100644
--- a/templates/tb-megamenu.html.twig
+++ b/templates/tb-megamenu.html.twig
@@ -29,10 +29,9 @@ if (window.matchMedia("(max-width: {{ block_config['breakpoint']}}px)").matches)
document.getElementById("{{ attributes.id }}").classList.add('tbm--mobile')
}
-{% set hide_mobile = block_config['hide-mobile-menu'] %}
-var hideMobile = {{ hide_mobile }}
+{# Make sure this value is a number. #}
+let hideMobile = {{ block_config['hide-mobile-menu']|default(0)|format_number }};
if (hideMobile === 1) {
- document.getElementById('{{ attributes.id }}').classList.add('tbm--mobile-hide')
+ document.getElementById('{{ attributes.id }}').classList.add('tbm--mobile-hide');
}
-