17 lines
523 B
JavaScript
17 lines
523 B
JavaScript
function search() {
|
|
var input, filter, ul, li, a, i, txtValue;
|
|
input = document.getElementById('searchInput');
|
|
filter = input.value.toUpperCase();
|
|
ul = document.getElementById("referenceList");
|
|
li = ul.getElementsByTagName('li');
|
|
|
|
for (i = 0; i < li.length; i++) {
|
|
a = li[i].getElementsByTagName("details")[0];
|
|
txtValue = a.textContent || a.innerText;
|
|
if (txtValue.toUpperCase().indexOf(filter) > -1) {
|
|
li[i].style.display = "";
|
|
} else {
|
|
li[i].style.display = "none";
|
|
}
|
|
}
|
|
} |