From 251be10c63d18f7a6b1a8fba9767b655a8763230 Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Fri, 6 Dec 2024 17:38:20 -0500 Subject: [PATCH] chore: Use anonymous function --- data_registry/templates/search.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/data_registry/templates/search.html b/data_registry/templates/search.html index 0b65519..eff9c69 100644 --- a/data_registry/templates/search.html +++ b/data_registry/templates/search.html @@ -45,15 +45,14 @@ }) }) -function handleCountryChange (event) { - if (event.target.value) { - window.location.href = event.target.value - } else { - window.location.href = '' - } -} document.addEventListener('DOMContentLoaded', () => { - document.getElementById('country-select').addEventListener('change', handleCountryChange) + const select = document.getElementById('country-select') + select.addEventListener('change', () => { + const url = select.value; + if (url) { + window.location.href = url + } + }) }) // {# "8. Make the button stationary." https://www.nngroup.com/articles/back-to-top/ #} const observer = new window.IntersectionObserver(entries => {