FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaScript-DOM-Tutorial/app.js at lesson-11 · philjaycee/JavaScript-DOM-Tutorial · GitHub
philjaycee
JavaScript-DOM-Tutorial
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaScript-DOM-Tutorial
/
app.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (20 loc) · 581 Bytes
Breadcrumbs
JavaScript-DOM-Tutorial
/
app.js
Copy path
File metadata and controls
24 lines (20 loc) · 581 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const
list
=
document
.
querySelector
(
'#book-list ul'
)
;
// delete books
list
.
addEventListener
(
'click'
,
(
e
)
=>
{
if
(
e
.
target
.
className
==
'delete'
)
{
const
li
=
e
.
target
.
parentElement
;
li
.
parentNode
.
removeChild
(
li
)
;
}
}
)
;
const
forms
=
document
.
forms
;
console
.
log
(
forms
)
;
console
.
log
(
forms
[
'add-book'
]
)
;
Array
.
from
(
forms
)
.
forEach
(
function
(
form
)
{
console
.
log
(
form
)
;
}
)
;
const
addForm
=
forms
[
'add-book'
]
;
addForm
.
addEventListener
(
'submit'
,
function
(
e
)
{
e
.
preventDefault
(
)
;
const
value
=
addForm
.
querySelector
(
'input[type="text"]'
)
.
value
;
console
.
log
(
value
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL