We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4c198d1 commit d141abbCopy full SHA for d141abb
src/components/TodoForm.ts
@@ -8,14 +8,17 @@ export default class TodoForm {
8
) {
9
$target.appendChild(this.$form);
10
this.render();
11
+ this.setEvent();
12
}
13
14
private render() {
15
this.$form.innerHTML = `
16
<input type="text" placeholder="할 일을 입력하세요" name="todo" minLength="2" autocomplete="off" />
17
<button>추가</button>
18
`;
19
+ };
20
21
+ private setEvent() {
22
this.$form.addEventListener("submit", (e) => {
23
e.preventDefault();
24
const $todo = this.$form.querySelector<HTMLInputElement>("input[name=todo]");
@@ -24,5 +27,5 @@ export default class TodoForm {
27
$todo.value = "";
25
28
this.onSubmit(text);
26
29
});
- };
30
+ }
31
0 commit comments