Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>To Do List</title>
</head>

<body>
<h1>To Do List</h1>
<div class="container">
<input id="inputField" type="text">
<button id="addToDo"> + </button>
<div class="to-dos" id="toDoList"> </div>
</div>
<script src="main.js"> </script>
</body>

</html>
22 changes: 22 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
let inputBox = document.getElementById('inputField')
let addToDo = document.getElementById('addToDo')
let toDoList = document.getElementById('toDoList')

addToDo.addEventListener('click', function(){
var list = document.createElement('li');
if (!inputBox.value)
alert('내용을 입력하세요!');
else
{
list.innerText = inputBox.value;
toDoList.appendChild(list);
inputBox.value= "";
}

list.addEventListener('click', function(){
list.style.textDecoration = "line-through";
})
list.addEventListener('dblclick', function(){
toDoList.removeChild(list);
})
})
22 changes: 22 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
html, body {
width: 50%;
margin: 0 auto;
font-family: Arial, Helvetica, sans-serif;
}

.container {
width: 360px;
}

#inputFiled {
width: 300px;
height: 46px;
border: 1px solid black;
outline: none;
font-size: 25px;
vertical-align: middle;
}

.to-dos {
margin-top:25px;
}