Skip to content

Commit 474710e

Browse files
committed
refactor: 최소 문자 개수 HTML 속성으로 변경 및 자동완성 기능 해제
1 parent 1c062e5 commit 474710e

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/components/TodoForm.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default class TodoForm {
1313

1414
private render() {
1515
this.$form.innerHTML = `
16-
<input type="text" placeholder="할 일을 입력하세요" name="todo" />
16+
<input type="text" placeholder="할 일을 입력하세요" name="todo" minLength="2" autocomplete="off" />
1717
<button>추가</button>
1818
`;
1919

@@ -24,10 +24,8 @@ export default class TodoForm {
2424
const $todo = this.$form.querySelector<HTMLInputElement>("input[name=todo]");
2525
if (!$todo) return;
2626
const text = $todo.value;
27-
if (text.length > 1) {
28-
$todo.value = "";
29-
this.onSubmit(text);
30-
} else alert("두 글자 이상 입력해주세요");
27+
$todo.value = "";
28+
this.onSubmit(text);
3129
});
3230
};
3331
}

0 commit comments

Comments
 (0)