Skip to content

Commit ddbb0b5

Browse files
Shaun PellingShaun Pelling
authored andcommitted
lesson 11 code
1 parent 5dc8cb2 commit ddbb0b5

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

app.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,18 @@ list.addEventListener('click', (e) => {
77
li.parentNode.removeChild(li);
88
}
99
});
10+
11+
const forms = document.forms;
12+
console.log(forms);
13+
console.log(forms['add-book']);
14+
15+
Array.from(forms).forEach(function(form){
16+
console.log(form);
17+
});
18+
19+
const addForm = forms['add-book'];
20+
addForm.addEventListener('submit', function(e){
21+
e.preventDefault();
22+
const value = addForm.querySelector('input[type="text"]').value;
23+
console.log(value);
24+
});

0 commit comments

Comments
 (0)