Skip to content

Commit 720555f

Browse files
committed
capture input
1 parent 278b2ef commit 720555f

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
<form>
13-
<textarea>
13+
<textarea name="message">
1414
What is populated with it
1515
</textarea>
1616
<input type="submit" />

src/main.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
import './style.css'
22

3+
const form = document.querySelector('form')
4+
const posts = document.querySelector('ol')
35

6+
form?.addEventListener('submit', e => {
7+
e.preventDefault()
48

9+
const data = new FormData(e.target)
10+
console.log("d", data.get('message'))
11+
12+
})

0 commit comments

Comments
 (0)