Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- pm2 상태 확인
- setInterval 외부 정지
- 데이터테이블 데이터 넣기
- pm2 설치
- invalid data
- DatePicker
- setInterval 정지
- transfer
- allow_anonymouse
- AntDesign
- pm2 확인
- mosquitto.conf
- 공인IP
- setInterval 중지
- pm2 시작
- setInterval clear
- listener 1883
- mosquitto
- 1883
- datagridview 직접입력
- timepicker
- c# datagridview 데이터 넣기
- pm2
- 맥 어드레스
- DataGridView 직접 입력
- mySQL_Replication
- map이 undefined가 뜰 때
- 서버동기화
- html #select #option #multiple
- Replication
Archives
- Today
- Total
개발 노트
투두리스트 html,css,js 본문
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="style.css" />
<script src="main.js"></script>
</head>
<body></body>
</html>
* {
box-sizing: border-box;
margin: 10px;
justify-content: center;
}
body {
font-family: "Open Sans", sans-serif;
margin: 0;
}
button {
cursor: pointer;
padding: 10;
}
div {
display: flex;
flex-wrap: wrap;
text-align: center;
}
input {
border-radius: 10px;
}
form {
display: flex;
flex-wrap: wrap;
text-align: center;
}
#testID {
color: #4646b4;
background: #aba8f4;
padding: 20px;
border-radius: 5px;
text-align: center;
}
#checkbox {
display: inline-block;
width: 25px;
height: 25px;
margin-right: 5px;
}
document.addEventListener("DOMContentLoaded", () => {
const addTodo = () => {
if (input.value !== "") {
const div = document.createElement("div");
document.body.appendChild(div);
const checkbox = document.createElement("input");
checkbox.type = "checkbox";
checkbox.id = "checkbox";
checkbox.addEventListener("change", () => {
if (checkbox.checked) {
div.style.textDecoration = "line-through";
} else {
div.style.textDecoration = "";
}
});
div.appendChild(checkbox);
const span = document.createElement("span");
span.textContent = input.value;
input.value = "";
div.appendChild(span);
const today = new Date();
const p = document.createElement("p");
p.textContent =
today.getHours() +
"시" +
today.getMinutes() +
"분" +
today.getSeconds() +
"초";
input.value = "";
div.appendChild(p);
const deleteButton = document.createElement("button");
deleteButton.textContent = "제거하기";
deleteButton.addEventListener("click", () => {
div.parentNode.removeChild(div);
});
div.appendChild(deleteButton);
}
};
const title = document.createElement("div");
document.body.appendChild(title);
title.id = "testID";
const h1 = document.createElement("h1");
h1.textContent = "할 일 목록";
title.appendChild(h1);
const form = document.createElement("div");
document.body.appendChild(form);
const input = document.createElement("input");
input.addEventListener("keyup", (event) => {
if (event.keyCode === 13) {
addTodo();
}
});
form.appendChild(input);
const addButton = document.createElement("button");
addButton.textContent = "추가하기";
form.appendChild(addButton);
addButton.addEventListener("click", () => {
if (input.value !== "") {
addTodo();
}
});
});
'JavaScript' 카테고리의 다른 글
사칙연산 연습문제 만들기 (0) | 2022.01.07 |
---|---|
사칙연산 사이트 만들기 (0) | 2022.01.05 |
DOM은 무엇인가 (0) | 2022.01.02 |
자바스크립트 객체 (0) | 2022.01.01 |
[자바스크립트] 알림창코드, 함수연습코드 (0) | 2021.12.31 |