Skip to content

Commit

Permalink
Merge pull request #401 from maykinmedia/issue/933-search-checkboxes
Browse files Browse the repository at this point in the history
[#933] Added automatic search submit when clicking on search filter
  • Loading branch information
alextreme authored Dec 22, 2022
2 parents b9cfb3b + e400352 commit 0eefaeb
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/open_inwoner/js/components/search/index.js
Original file line number Diff line number Diff line change
@@ -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) => {
Expand All @@ -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)
})
})

0 comments on commit 0eefaeb

Please sign in to comment.