Skip to content

Commit 437ed7a

Browse files
authored
init
1 parent 110fa95 commit 437ed7a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

example.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// getting the Form element and listener it
2+
document.querySelector('form')
3+
.addEventListener('submit', e => {
4+
// stop the default functions
5+
e.preventDefault()
6+
// store the data in a variable, create new FormData to intruduce the form target data
7+
const data = Object.fromEntries(
8+
new FormData(e.target)
9+
)
10+
// show the Object in a console log
11+
console.log(JSON.stringify(data))
12+
})

0 commit comments

Comments
 (0)