zachleat / filter-container

Filtering visible child elements based on form field values.

Home Page:https://zachleat.github.io/filter-container/demo.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for resetting form

cbirdsong opened this issue · comments

If would be great there was a way to add a reset button to clear the filter, either by type="reset"1or a data attribute:

<button type="reset">Reset</button>
<button data-filter-reset>Reset</button>

Bonus points if you could supply a key and only reset those fields, like <button data-filter-reset="continent">Reset Continents</button> for the set of checkboxes in the example.

Footnotes

  1. I don't see type="reset" too often, not sure if there are weird issues with it or if screen readers are aware of it? MDN discourages using it for UX reasons but it seems pretty reasonable for this kind of form.