TO DO LIST
How do I make an to do list?
What is a to do list? How do you make a to do list? This script and codes were developed by J Clarke on 09 September 2022, Friday.
TO DO LIST - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>TO DO LIST </title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <html lang="en">
<head> <title>Task List Example</title> <meta charset="utf"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
</head> <script src="todoList.js"></script> <body> <br> <center> <div class = "row" id = "content"> <div class = "col-sm-2" <h1 id = "des"> TO DO </h1> <center> <input id="task"> <br> </center> <button id="add">Add</button> <br> <div id="todos"></div> </center> </div> </div> </body> <script src="js/index.js"></script>
</body>
</html>
TO DO LIST - Script Codes CSS Codes
body { font-family: Verdana; height: 75%;
}
#content { position:relative; background-color: #7FFFD4; width: 75%; border-top-right-radius: 10em; border-top-left-radius: 10em; border-bottom-left-radius: 10em; border-bottom-right-radius: 10em;
}
#todos { color: black; width: 100px; height: 100px; font-size: 36px;
}
#add { font-size: 60px; height: 75px; width: 400px;
}
#task { font-size: 40px;
}
#des { font-size: 100px;
}
TO DO LIST - Script Codes JS Codes
// Lesson Learned
// - Avoid global variables
// - Strive to make functions reusable
function get_todos() { var todos = new Array; var todos_str = localStorage.getItem('todo'); if (todos_str !== null) { todos = JSON.parse(todos_str); } return todos;
}
function add() { var task = document.getElementById('task').value; var todos = get_todos(); todos.push(task); localStorage.setItem('todo', JSON.stringify(todos)); show(); return false;
}
function remove() { var id = this.getAttribute('id'); var todos = get_todos(); todos.splice(id, 1); localStorage.setItem('todo', JSON.stringify(todos)); show(); return false;
}
function show() { var todos = get_todos(); var html = '<ul>'; for(var i=0; i<todos.length; i++) { html += '<li>' + todos[i] + '<button class="remove" id="' + i + '">x</button></li>'; };
//? html += '</ul>'; document.getElementById('todos').innerHTML = html; var buttons = document.getElementsByClassName('remove'); for (var i=0; i < buttons.length; i++) { buttons[i].addEventListener('click', remove); };
}
document.getElementById('add').addEventListener('click', add);
show();
// 1ST ATTEMPT
/*
function addNewItem(list, itemText) {
var listItem = document.createElement("li");
listItem.textContent = itemText;
list.appendChild(listItem);}
var btnNew = document.getElementById("btnAdd");
btnNew.addEventListener('click', add);
show();
var itemText = prompt("What should we name this new item? ")
addNewItem(document.getElementByid("todoList"), itemText);
*/
Developer | J Clarke |
Username | Jussic |
Uploaded | September 09, 2022 |
Rating | 3 |
Size | 2,635 Kb |
Views | 20,240 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Em | 2,552 Kb |
Marcus Garvey | 2,813 Kb |
Project1_Video | 2,308 Kb |
George William Gordon | 2,810 Kb |
Paul Bogle | 3,307 Kb |
Norman Washington Manley | 2,818 Kb |
CS_ Web Practice | 2,002 Kb |
Auto Play Video | 3,142 Kb |
Sir Alexander Bustamante | 2,811 Kb |
Project1_Contact | 2,390 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Hexagons | Ashmind | 4,360 Kb |
Web Spiral - p5.js | TWAIN | 2,183 Kb |
Drill-down Map | Good886 | 8,484 Kb |
Simple Responsive Text | Fbrz | 2,282 Kb |
Blank Starter | Mhartington | 2,171 Kb |
Page Transitions in Backbone | Mikefowler | 3,691 Kb |
A Pen by Kenny Mark | Kennymark | 5,574 Kb |
Nice textured background | Hans | 2,659 Kb |
Delete Hover | Chungman93 | 2,557 Kb |
Nice responsive team page | Infomiho | 3,139 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!