Build a filter widget
Build a searchable card list with delegation, AJAX and accessible empty states.
What you will be able to do
- Use delegation for dynamic cards.
- Debounce the input.
- Show loading, empty and error states.
- Keep the count announced politely.
In plain English
The project combines selection, events, DOM updates and AJAX. Filter cards from an input, load more from an endpoint, handle empty and error states, and keep the markup accessible.
let timer
$('#search').on('input', function () {
clearTimeout(timer)
const term = this.value.trim().toLowerCase()
timer = setTimeout(() => {
$('.card').each(function () {
const text = $(this).text().toLowerCase()
$(this).toggle(text.includes(term))
})
$('#count').text($('.card:visible').length + ' results')
}, 200)
})Your turn
MediumAnnounce the count
Update a live region with the number of visible cards.
JAVASCRIPT · starter
$('#count').text()Check your understanding before moving on.
Knowledge checkQuestion 1
Why debounce the search input?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.