diff --git a/src/open_inwoner/js/components/search/index.js b/src/open_inwoner/js/components/search/index.js index 476380d469..98efa88b8f 100644 --- a/src/open_inwoner/js/components/search/index.js +++ b/src/open_inwoner/js/components/search/index.js @@ -1,4 +1,6 @@ -const radioButtons = document.querySelectorAll('.button-radio__input') +const radioButtons = document.querySelectorAll( + '.feedback__options .button-radio__input' +) ;[...radioButtons].forEach((radioButton) => { radioButton.addEventListener('click', (event) => { @@ -8,3 +10,17 @@ const radioButtons = document.querySelectorAll('.button-radio__input') ) }) }) + +var timerId = 0 + +const searchForm = document.getElementById('search-form') + +const filterButtons = document.querySelectorAll('.filter .checkbox__input') +;[...filterButtons].forEach((checkbox) => { + checkbox.addEventListener('change', (event) => { + clearInterval(timerId) + timerId = setInterval(() => { + searchForm.submit() + }, 250) + }) +})