FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
hello-javascript/Intermediate/15-tasklist.js at main · mouredev/hello-javascript · GitHub
mouredev
/
hello-javascript
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
8.2k
Code
Issues
4
Pull requests
7
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
hello-javascript
/
Intermediate
/
15-tasklist.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (23 loc) · 648 Bytes
Breadcrumbs
hello-javascript
/
Intermediate
/
15-tasklist.js
Copy path
File metadata and controls
32 lines (23 loc) · 648 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
25
26
27
28
29
30
31
32
/*
Clase 70 - DOM
Vídeo: https://youtu.be/iJvLAZ8MJ2E?t=22342
*/
const
text
=
document
.
getElementById
(
"text"
)
const
button
=
document
.
getElementById
(
"button"
)
const
list
=
document
.
getElementById
(
"list"
)
function
addTask
(
)
{
if
(
text
.
value
===
""
)
return
const
newElement
=
document
.
createElement
(
"li"
)
newElement
.
textContent
=
text
.
value
newElement
.
addEventListener
(
"click"
,
(
)
=>
{
newElement
.
remove
(
)
}
)
list
.
appendChild
(
newElement
)
text
.
value
=
""
}
button
.
addEventListener
(
"click"
,
addTask
)
text
.
addEventListener
(
"keypress"
,
(
event
)
=>
{
if
(
event
.
key
===
"Enter"
)
{
addTask
(
)
}
}
)
Back
|
FazBrowse Home
|
New Git URL