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
32 changes: 32 additions & 0 deletions assignments/todo_list/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const completed_task=document.querySelectorAll('button')[0]
const pending_task=document.querySelectorAll('button')[1]

function completed_work(){
fetch("https://jsonplaceholder.typicode.com/todos")
.then(Response=>Response.json())
.then(json =>{
let li=`<tr><th>ITEM ID</th><th>TASK</th></tr>`
json.forEach(todo => {
if (todo.completed==true){
li+=`<tr><td>${todo.id} </td><td>${todo.title} </td></tr>`
}
});
document.getElementById("table1").innerHTML = li;
})
}

function pending_work(){
fetch("https://jsonplaceholder.typicode.com/todos")
.then(Response=>Response.json())
.then(json =>{
let li=`<tr><th>ITEM ID</th><th>TASK</th></tr>`
json.forEach(todo => {
if (todo.completed==false){
li+=`<tr><td>${todo.id} </td><td>${todo.title} </td></tr>`
}
});
document.getElementById("table2").innerHTML = li;
})
}
completed_task.addEventListener("click",completed_work)
pending_task.addEventListener("click",pending_work)
54 changes: 54 additions & 0 deletions assignments/todo_list/style_sheet.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
h1 {
width: 30% ;
height: 50px;
margin: 50px 0px 50px 450px;
padding: 15px;
background-color: rgb(165, 103, 103);
color: white;
text-align: center;
border-radius: 15px;
}

button:hover {
color: black;
}

td:hover{
color: black;
}

button {
display: inline-block;
width: 30%;
height: 60px;
margin: 10px 100px 10px 100px ;
padding: 10px;
background-color: rgb(165, 103, 103);
color: white;
text-align: center;
border-radius: 15px;
font-size: 30px;

}

table {
display: inline-block;
background-color: rgb(165, 103, 103);
color: white;
border: 8px solid white;
border-radius: 8px;
margin: 5px;
padding: 10px;
vertical-align: top;
}

td {
font-size: 20px;
padding: 5px;
text-align: left;
}

th {
font-size: 25px;
}

11 changes: 8 additions & 3 deletions assignments/todo_list/todo.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
<html>
<head>
<title>Todo List</title>
<link href="./style_sheet.css" rel="stylesheet" >
</head>
<body>
<div>
<input type='text' name='todo_input'>
<button type='submit'>Add Todo</button>
<div class='todos'></div>
<h1>TODO LIST</h1>
<button id="completed" type="submit" class="buttons">COMPLETED TASK</button>
<button id="Pending" type="submit" class="buttons">PENDING TASK</button>
<table id="table1" class="tables"></table>
<table id="table2" class="tables"></table>
</div>
</body>
<script src='./script.js'></script>
</html>
</html>
</html>