Mercurial > repos > brasset_jensen > srnapipe
comparison bin/js/filter.js @ 40:4bc00caa60b4 draft
Uploaded
author | pierre.pouchin |
---|---|
date | Thu, 12 Jul 2018 08:27:08 -0400 |
parents | |
children | 263819fdda14 |
comparison
equal
deleted
inserted
replaced
39:40fba438db33 | 40:4bc00caa60b4 |
---|---|
1 function search(input) { | |
2 // Declare variables | |
3 var elt, filter, uls, li, a, i; | |
4 elt = input.parentElement; | |
5 filter = input.value.toUpperCase(); | |
6 uls = elt.getElementsByClassName('thumbs'); | |
7 | |
8 // Loop through all list items, and hide those who don't match the search query | |
9 for (j = 0; j < uls.length; j++) { | |
10 li = uls[j].getElementsByTagName('li'); | |
11 for (i = 0; i < li.length; i++) { | |
12 a = li[i].getElementsByTagName("a")[0]; | |
13 if (a.innerHTML.toUpperCase().indexOf(filter) > -1) { | |
14 li[i].style.display = ""; | |
15 } else { | |
16 li[i].style.display = "none"; | |
17 } | |
18 } | |
19 } | |
20 } |