Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1주차] 신동현 미션 제출합니다 #9

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
6 changes: 6 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ function todoToDone() {
}

function newTodo() {
//input null 예외처리
if (inputTodo.value === "") {
alert("Please Enter Todo.");
return;
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

화면 캡처 2023-09-16 204259

input에 스페이스바를 누르고, + 버튼을 누르면 위 사진처럼 입력이 그대로 들어가요!
trim()을 사용해서 입력값의 양쪽 공백을 없앤 뒤, ""이면 alert 창이 나오도록 바꾸면 좋을 것 같아요!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스페이스바 예외처리는 생각하지 못했는데, 예외처리를 추가해야겠네요~! 오류 찾아주셔서 감사합니다

var newDiv = document.createElement("div");
var newText = document.createTextNode(inputTodo.value); // input 태그에 쓴 text 값
newDiv.appendChild(newText);
Expand Down