diff --git a/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js b/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js index 71a7260ea..9ba3fe53a 100644 --- a/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js +++ b/src/pydata_sphinx_theme/assets/scripts/pydata-sphinx-theme.js @@ -306,7 +306,7 @@ function checkPageExistsAndRedirect(event) { // Populate the version switcher from the JSON config file var themeSwitchBtns = document.querySelectorAll("version-switcher__button"); -if (themeSwitchBtns) { +if (themeSwitchBtns.length) { fetch(DOCUMENTATION_OPTIONS.theme_switcher_json_url) .then((res) => { return res.json();