TO DO LIST

Developer
Size
2,635 Kb
Views
20,240

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 Previews

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);
*/
TO DO LIST - Script Codes
TO DO LIST - Script Codes
Home Page Home
Developer J Clarke
Username Jussic
Uploaded September 09, 2022
Rating 3
Size 2,635 Kb
Views 20,240
Do you need developer help for TO DO LIST?

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!

J Clarke (Jussic) Script Codes
Create amazing blog posts with AI!

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!