Skip to content

Commit

Permalink
updates readme
Browse files Browse the repository at this point in the history
  • Loading branch information
smohadjer committed Oct 23, 2023
1 parent 24696e9 commit 5480ca6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ Examples on Web:
## Usage
- See minimal demo. Below snippet from that demo can show you how to use the library. See other demo examples for more elaborate ways of using the library.
```
<ul data-filter-names="fruit">
<li data-filter-fruit="apple">Apple</li>
<li data-filter-fruit="orange">Orange</li>
<li data-filter-fruit="banana">Banana</li>
<li data-filter-fruit="kiwi">Kiwi</li>
<li data-filter-fruit="pear">Pear</li>
</ul>
<script type="module">
import FilterList from '../src/filterList.js';
const filter = new FilterList({
element: document.querySelector('ul'),
});
</script>
<ul data-filter-names="fruit">
<li data-filter-fruit="apple">Apple</li>
<li data-filter-fruit="orange">Orange</li>
<li data-filter-fruit="banana">Banana</li>
<li data-filter-fruit="kiwi">Kiwi</li>
<li data-filter-fruit="pear">Pear</li>
</ul>
<script type="module">
import FilterList from '../src/filterList.js';
const filter = new FilterList({
element: document.querySelector('ul'),
});
</script>
```
- Name of filters should be set on the list's parent element using data attribute with the syntax `data-filter-names=“filtername1 filtername2”`.
- List items that match a filter need a data attribute with syntax `data-filter-filtername=“filtervalue1”`. If an item has multiple values for a certain filter separate them by space: `data-filter-filtername=“filtervalue1 filtervalue2”`.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "filterlist",
"version": "3.3.1",
"version": "3.3.2",
"description": "filterList.js allows filtering of any HTML list or group of elements via data attributes. Filters can be set or changed via URL parameters, or form elements, or by other scripts. The script is written in plain JavaScript and has no dependencies.",
"main": "src/filterList.js",
"keywords": ["filter", "filtering", "html", "elements"],
Expand Down

0 comments on commit 5480ca6

Please sign in to comment.