simplified the filter function in step 3, updated instructions to add it to the buttons. fixes #23

This commit is contained in:
Micah Godbolt
2019-02-27 09:26:36 -08:00
parent 17c9f2410a
commit e558da25ab
5 changed files with 23 additions and 12 deletions

View File

@@ -1,5 +1,10 @@
## Exercise
### Update Navigation
1. Add an onclick attribute to all 3 buttons in the navigation
2. For each onclick call the `filter` function. In our function we need a reference to the clicked button, so pass in the keyword `this` as the only parameter.
### Write updateRemaining function
1. Get a reference to the span with the `remaining` class, and store it in a variable

View File

@@ -64,9 +64,11 @@
// clearCompleted
function filter(filterName, button) {
function filter(button) {
document.querySelector('.selected').classList.remove('selected');
button.classList.add('selected');
const filterName = button.innerText;
for (let todo of document.querySelectorAll('.todo')) {
const checked = todo.querySelector('input').checked == true;
if (filterName == 'all') {