html
html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="main.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Montserrat|Open+Sans" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/date-fns/1.30.1/date_fns.min.js"></script>
<title>To Do List</title>
</head>
<body>
<div class="cover"></div>
<div class="top">
<h1>To do List</h1>
<form id="create-task">
<div id="input-button">
<input type="text" placeholder="Add an item..." class="item">
<input type="text" placeholder="Due Date..." id="date">
<input type="text" placeholder="About the task..." id="userInfo">
<button class="add">Create Task</button>
</div>
</form>
</div>
<div id="search-box">
<input type="text" placeholder="Search Tasks..." id="search">
</div>
Enter to Rename, Shift+Enter to Preview
css
css
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
/* January 12, 2019 */
body {
margin: 0;
padding: 0;
font-family: 'Montserrat', sans-serif;
text-align: center;
border-radius: 15px;
border: 5px solid #E8E8E8;
}
/* Styles the Wrapping Div Around the Input Form */
.top {
background: #E8E8E8;
padding: 2rem;
border-radius: 5px;
}
/* Header */
h1 {
margin-top: 0;
font-size: 3rem;
}
/* Form[1] Creating New To Do Items */
#input-button {
display: flex;
flex-direction: column;
width: 300px;
margin: auto;
Enter to Rename, Shift+Enter to Preview
js
js
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
window.onload=()=>{
(function(){
const taskList = document.querySelector('ul');
const completedList = document.querySelector('#completed-task');
const editTask = document.querySelector('#edit-task');
const cover = document.querySelector('.cover');
const editedInfo = document.querySelector('#edited-info');
const editedDate = document.querySelector('#edited-date');
const editedName = document.querySelector('#edited-item');
let editedListItem;
/* Update: February 6, 2019 --> Number of Tasks Tracker */
const counter = document.querySelector('#counter');
/* Update: February 8, 2019 --> Search Tasks*/
const searchBar = document.getElementById('search');
let exampleTask = document.querySelector('#task-list li');
// Cleaning up my code --> Storing repeated pieces of code inside functions
const taskCounter = () => {
let numberOfTasks = taskList.children.length - 1;
counter.textContent = numberOfTasks;
};
document.querySelector('button').addEventListener('click', function(e) {
/* Preventing Page Default Page Refresh*/
e.preventDefault();
/* Grabbing User Input */
let userInput = document.querySelector('input').value;
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run