lambda on forEach loop for matching search query

This commit is contained in:
David Wu
2017-12-20 01:48:05 +01:00
parent 2ed34ba41f
commit 059dda9edc

View File

@ -25,9 +25,9 @@
<script> <script>
function search() { function search() {
var input, filter, i; var input, filter, i;
input = document.querySelector('#searchInput'); input = document.querySelector('searchInput');
filter = input.value.toUpperCase(); filter = input.value.toUpperCase();
tags = Array.from(document.querySelector('#snippetListDrawer').getElementsByTagName('a')); tags = Array.from(document.querySelector('snippetListDrawer').getElementsByTagName('a'));
tags.forEach(x => {x.getAttribute("href").toUpperCase().indexOf(filter) > -1 ? x.style.display = "" : x.style.display = "none"}); tags.forEach(x => {x.getAttribute("href").toUpperCase().indexOf(filter) > -1 ? x.style.display = "" : x.style.display = "none"});
// for(var i = 0; i < tags.length; i++) { // for(var i = 0; i < tags.length; i++) {