Toggle navigation
TUTORIAL HOME
W3Data Filters
❮ Previous Next ❯
Filter Lists
Search for a name in the input field.

Search for names..
{{CustomerName}}
Example
function myFunction() {
var input, filter, ul, li, a, i;
input = document.getElementById(" myInput");
filter = input.value.toUpperCase();
ul = document.getElementById("myUL" );
li = ul.getElementsByTagName("li");
for (i = 0; i < li.length; i++) {
if (li[i].innerHTML.toUpperCase() .indexOf(filter) > -1) {
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}
»
Filter Tables

Search for names..
Name Country
Alfreds Futterkiste Germany
Berglunds snabbkop Sweden
Island Trading UK
Koniglich Essen Germany
Laughing Bacchus Winecellars Canada
Magazzini Alimentari Riuniti Italy
North/South UK
Paris specialites France
Example
function myFunction() {
var input, filter, table, tr, td, i;
input = document.getElementById(' myInput');
filter = input.value.toUpperCase();
table = document.getElementById(" myTable");
tr = table.getElementsByTagName(' tr');
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName(' td')[0];
if (td) {
if (td.innerHTML.toUpperCase(). indexOf(filter) gt; -1) {
tr[i].style.display = '';
} else {
tr[i].style.display = 'none';
}
}
}
}
»
❮ Previous Next ❯
TUTORIAL HOME
W3Data Filters
❮ Previous Next ❯
Filter Lists
Search for a name in the input field.

Search for names..
{{CustomerName}}
Example
function myFunction() {
var input, filter, ul, li, a, i;
input = document.getElementById("
filter = input.value.toUpperCase();
ul = document.getElementById("myUL"
li = ul.getElementsByTagName("li");
for (i = 0; i < li.length; i++) {
if (li[i].innerHTML.toUpperCase()
li[i].style.display = "";
} else {
li[i].style.display = "none";
}
}
}
»
Filter Tables

Search for names..
Name Country
Alfreds Futterkiste Germany
Berglunds snabbkop Sweden
Island Trading UK
Koniglich Essen Germany
Laughing Bacchus Winecellars Canada
Magazzini Alimentari Riuniti Italy
North/South UK
Paris specialites France
Example
function myFunction() {
var input, filter, table, tr, td, i;
input = document.getElementById('
filter = input.value.toUpperCase();
table = document.getElementById("
tr = table.getElementsByTagName('
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName('
if (td) {
if (td.innerHTML.toUpperCase().
tr[i].style.display = '';
} else {
tr[i].style.display = 'none';
}
}
}
}
»
❮ Previous Next ❯
No comments:
Post a Comment