FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaScript-DOM-Tutorial/app.js at lesson-9 · itztemi/JavaScript-DOM-Tutorial · GitHub
itztemi
JavaScript-DOM-Tutorial
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
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
21 lines (15 loc) · 592 Bytes
Breadcrumbs
JavaScript-DOM-Tutorial
/
app.js
Copy path
File metadata and controls
21 lines (15 loc) · 592 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
const
listItems
=
document
.
querySelectorAll
(
'#book-list ul li'
)
;
Array
.
from
(
listItems
)
.
forEach
(
function
(
item
)
{
item
.
addEventListener
(
'click'
,
(
e
)
=>
{
const
li
=
e
.
target
.
parentElement
;
console
.
log
(
'child element to remove:'
,
li
)
;
console
.
log
(
'parent element to remove child from:'
,
li
.
parentElement
)
;
li
.
parentNode
.
removeChild
(
li
)
;
}
)
;
}
)
;
// prevent default behaviour
const
link
=
document
.
querySelector
(
'#page-banner a'
)
;
link
.
addEventListener
(
'click'
,
function
(
e
)
{
e
.
preventDefault
(
)
;
console
.
log
(
'Navigation to'
,
e
.
target
.
textContent
,
'was prevented'
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL