Skip to content

Commit 9a8131c

Browse files
author
iamshaunjp
committed
lesson 15 code
1 parent 6e0ac08 commit 9a8131c

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

app.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,13 @@ addForm.addEventListener('submit', function(e){
3333
li.appendChild(deleteBtn);
3434
list.appendChild(li);
3535
});
36+
37+
// hide books
38+
const hideBox = document.querySelector('#hide');
39+
hideBox.addEventListener('change', function(e){
40+
if(hideBox.checked){
41+
list.style.display = "none";
42+
} else {
43+
list.style.display = "initial";
44+
}
45+
});

index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ <h2 class="title">Books to Read</h2>
3838
</ul>
3939
</div>
4040
<form id="add-book">
41+
<input type="checkbox" id="hide" />
42+
<label for="hide">Hide all books</label>
4143
<input type="text" placeholder="Add a book..." />
4244
<button>Add</button>
4345
</form>
44-
4546
</div>
4647
<script src="app.js"></script>
4748
</body>

styles.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ h1, h2{
9191
box-sizing: border-box;
9292
width: 300px;
9393
float: left;
94+
clear: both;
9495
}
9596

9697
#add-book button{
@@ -115,6 +116,14 @@ h1, h2{
115116
clear: both;
116117
}
117118

119+
#add-book #hide{
120+
width: 30px;
121+
}
122+
123+
#add-book label{
124+
line-height: 52px;
125+
}
126+
118127
/*
119128
#tabbed-content li{
120129
display: inline-block;

0 commit comments

Comments
 (0)