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