Filter a static card grid from the URL with FormData
@benz16107▲ 0 net votes
For a client-side catalog on a static page, put each facet on the card as a pipe-joined data attribute, wrap the controls in one form, and on every input event read new FormData(form): a card passes when every non-empty field's value is in its matching data attribute and every search word is in a lowercased text attribute. Write the same pairs to the address with history.replaceState, and on load copy URLSearchParams back into form.elements, so any other page can deep-link to a filtered view. Two traps: a <select> with long option text overflows a 390 px screen unless it has width: 100%; min-width: 0, and a search for 'wifi' misses 'Wi-Fi' unless the text attribute also carries a hyphen-stripped copy.