We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9a8131c commit f166e3aCopy full SHA for f166e3a
app.js
@@ -43,3 +43,18 @@ hideBox.addEventListener('change', function(e){
43
list.style.display = "initial";
44
}
45
});
46
+
47
+// filter books
48
+const searchBar = forms['search-books'].querySelector('input');
49
+searchBar.addEventListener('keyup', (e) => {
50
+ const term = e.target.value.toLowerCase();
51
+ const books = list.getElementsByTagName('li');
52
+ Array.from(books).forEach((book) => {
53
+ const title = book.firstElementChild.textContent;
54
+ if(title.toLowerCase().indexOf(e.target.value) != -1){
55
+ book.style.display = 'block';
56
+ } else {
57
+ book.style.display = 'none';
58
+ }
59
+ });
60
+});
0 commit comments