-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
182 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
const inputBox = document.getElementById("input-box") | ||
const listContainer = document.getElementById("list-container") | ||
|
||
function addTask() { | ||
if(inputBox.value === ""){ | ||
alert("You have to write something!"); | ||
} | ||
else { | ||
let li = document.createElement("li"); | ||
li.innerHTML = inputBox.value; | ||
listContainer.appendChild(li); | ||
let span = document.createElement("span"); | ||
span.innerHTML = "\u00d7"; | ||
li.appendChild(span); | ||
} | ||
inputBox.value = ""; | ||
saveData(); | ||
} | ||
|
||
listContainer.addEventListener("click", function(e){ | ||
if(e.target.tagName === "LI") { | ||
e.target.classList.toggle("checked"); | ||
saveData(); | ||
} | ||
else if (e.target.tagName === "SPAN"){ | ||
e.target.parentElement.remove() | ||
saveData(); | ||
} | ||
}, false); | ||
|
||
function saveData() { | ||
localStorage.setItem("data", listContainer.innerHTML); | ||
} | ||
|
||
function showData(){ | ||
listContainer.innerHTML = localStorage.getItem("data"); | ||
} | ||
showData(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<link href="CSS/style.css" rel="stylesheet"> | ||
<title>YeahBuddy!</title> | ||
</head> | ||
<body> | ||
<header class="header"> | ||
<h1 class="header__title">ToDo List</h1> | ||
<nav class="header__nav"><a href="index.html">General</a> <a href="scoreboard.html">PRScoreboard</a> <a href="achievements.html">Achievements</a> <a href="resources.html">Resources</a> <a href="profile.html">Profile</a> <a href="todo.html" class="active">ToDoList</a></nav> | ||
</header> | ||
<main class="body"> | ||
<div class="container"> | ||
<div class="todo"> | ||
<h2>ToDo List</h2> | ||
<div class="row"> | ||
<input id="input-box" type="text" placeholder="Type your task"> | ||
<button onclick="addTask()">Add task</button> | ||
</div> | ||
<ul class="todoList" id="list-container"> | ||
<!-- <li class="checked">Task 1</li> | ||
<li>Task 2</li> | ||
<li>Task 3</li> --> | ||
</ul> | ||
</div> | ||
</div> | ||
</main> | ||
<script src="JS/todoList.js"></script> | ||
<footer> | ||
</footer> | ||
</body> | ||
</html> |