Skip to content

Commit

Permalink
[#1739] Fixed event interval for search page filters
Browse files Browse the repository at this point in the history
  • Loading branch information
jiromaykin committed Sep 11, 2023
1 parent defa012 commit 4d6779a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/open_inwoner/js/components/search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ const radioButtons = document.querySelectorAll(
})
})

var timerId = 0
let timerId = null

const searchForm = document.getElementById('search-form')

const filterButtons = document.querySelectorAll('.filter .checkbox__input')
;[...filterButtons].forEach((checkbox) => {
checkbox.addEventListener('change', (event) => {
clearInterval(timerId)
timerId = setInterval(() => {

// Set a new interval
timerId = setTimeout(() => {
searchForm.submit()
}, 250)
})
Expand Down

0 comments on commit 4d6779a

Please sign in to comment.