filter data name value - Free Download Filter HTML Elements By Data Name & Value - data-filter

Free Download Filter HTML Elements By Data Name & Value – data-filter

Posted on

This time I will share jQuery Plugin and tutorial about Filter HTML Elements By Data Name & Value – data-filter, hope it will help you in programming stack.

filter data name value - Free Download Filter HTML Elements By Data Name & Value - data-filter
File Size: 16.7 KB
Views Total: 5004
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A tiny and performant data filtering plugin that makes it possible to filter through a list of entries by data names or data values you specify.

How to use it:

1. Download and place the JavaScript file jquery-data-filter.min.js after jQuery.

1 <script src="/path/to/cdn/jquery.min.js"></script>
2 <script src="/path/to/dist/jquery-data-filter.min.js"></script>

2. Categorize your data using data attributes as follows:

01 <div id="language-list">
02   <p class="filter-me" data-html="HTML5">
03     HTML 5
04   </p>
05   <p class="filter-me" data-html="HTML4">
06     HTML 4
07   </p>
08   <p class="filter-me" data-html="XML">
09     XML
10   </p>
11   <p class="filter-me" data-javascript="jQuery">
12     jQuery
13   </p>
14   <p class="filter-me" data-javascript="JavaScript">
15     JavaScript
16   </p>
17   <p class="filter-me" data-javascript="Angular">
18     Angular
19   </p>
20   <p class="filter-me" data-javascript="React">
21     ReactJS
22   </p>
23   <p class="filter-me" data-css="CSS3">
24     CSS 3
25   </p>
26   <p class="filter-me" data-css="CSS4">
27     CSS 4
28   </p>
29 </div>

3. Filter the list by data name:

1 // no results
2 $(".filter-me").filterData("node").length
3  
4 // output: 4
5 $(".filter-me").filterData("javascript").length
6  
7 // output: HTML 5, HTML 4, XML
8 $(".filter-me").filterData("html").text();

4. Filter the list by data values:

1 // output: jQuery
2 $(".filter-me").filterData("javascript", "jQuery").text();

Changelog:

v1.0.9 (2020-08-13)


This awesome jQuery plugin is developed by godoyrw. For more Advanced Usages, please check the demo page or visit the official website.