A jQuery plugin for searching the DOM ↓ Download
It lets you search within an element (e.g.: a table or a list), narrowing down the inner elements using LiquidMetal, which is way better than whatever else you could come up with.
Using a text field #search
to search in a list #fruits
:
$('input#search').domsearch('ul#fruits');
In the table below, using only the weight field (assuming <td class="weight">
):
$('#search').domsearch('table#fruits', {criteria: 'td.weight'});
Same as the previous example, using 2 fields as criteria:
$('#search').domsearch('table#fruits', {criteria: ['td.price', 'td.weight']});
Try it with typos, incomplete names, and generally confusing but similar words to what you're actually searching for.
Name | Weight |
---|---|
Apple | 0.1kg |
Orange | 0.2kg |
Watermelon | 2kg |
Peach | 0.1kg |
Pear | 0.2kg |
Passionfruit | 0.05kg |
Apricot | 0.02kg |
Lime | 0.01kg |
Imbu | 0.02kg |
Indonesian Guavas | 0.3kg |
domsearch.js is made with ♥ by @julio_ody. Source is on GitHub. The initial work was done while I was working at Incite, so props to them.