Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/component/filter

dynamic dom node filtering via callback
https://github.com/component/filter

Last synced: 13 days ago
JSON representation

dynamic dom node filtering via callback

Awesome Lists containing this project

README

        

# filter

dynamic dom node filtering via callback.

## Installation

$ component install component/filter

## Example

When list items contain the relevant text a `.hide` class is added
for styling the filter.

```js
var filter = require('filter');
var ul = document.querySelector('ul');
var input = document.querySelector('input');

input.onkeyup = function(e){
var str = input.value;
filter(ul, function(li){
return ~li.textContent.indexOf(str);
});
};
```

## License

MIT