Skip to content

Commit 5895945

Browse files
committed
to do list made in vs
1 parent b698a92 commit 5895945

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

Projects/Todolist/app.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
button=document.querySelector(".bttn")
2+
console.log(button)
3+
item=document.querySelector(".item")
4+
todo=document.querySelector(".todo")
5+
6+
7+
button.addEventListener("click",(event)=>{
8+
console.log("button was clicked")
9+
console.log(item.value)
10+
11+
if(item.value!=""){
12+
console.log("You have entered some text")
13+
14+
newli=document.createElement("li")
15+
style(newli)
16+
17+
let msg=item.value
18+
console.log(msg)
19+
newli.innerText=msg;
20+
todo.appendChild(newli)
21+
item.value=""
22+
}
23+
else{
24+
console.log("Enter some text")
25+
}
26+
27+
28+
})
29+
30+
31+
function style(newli){
32+
newli.style.backgroundColor="#FFE7E7";
33+
newli.style.margin="6px"
34+
newli.style.width="80%"
35+
newli.style.borderRadius="6px"
36+
newli.style.textAlign="left"
37+
newli.style.padding="3px"
38+
}

Projects/Todolist/index.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>To Do List</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<div class="maincontainer">
11+
<div class="head"><h2 class="h1">To Do List</h2></div>
12+
<div class="text">
13+
<input type="text" class="item">
14+
<button class="bttn"> Add to List</button>
15+
</div>
16+
<ul class="todo" list-style="none">
17+
18+
</ul>
19+
20+
</div>
21+
22+
<script src="app.js"></script>
23+
</body>
24+
</html>

Projects/Todolist/style.css

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
*{
2+
margin: 0;
3+
padding: 0;
4+
}
5+
6+
.maincontainer{
7+
display: flex;
8+
justify-content: center;
9+
text-align: center;
10+
flex-direction: column;
11+
margin:5% 30% 5% 30%;
12+
padding:20px 0 15% 0;
13+
background-color:#CAA6A6;
14+
border-radius: 10px;
15+
16+
}
17+
18+
.h1{
19+
float: left;
20+
margin-bottom: 10%;
21+
padding-left: 5px;
22+
color:#611d32;
23+
}
24+
.item{
25+
background-color: white;
26+
border-radius: 10px;
27+
border: none;
28+
padding: 7px;
29+
float: left;
30+
31+
32+
}
33+
.bttn{
34+
border: none;
35+
border-radius:10px ;
36+
background-color: #944E63;
37+
color: white;
38+
padding: 6px;
39+
float: left;
40+
margin-left: 4px;
41+
42+
}
43+
.text{
44+
padding-left: 5px;
45+
}
46+
47+
48+
body{
49+
background-color: #944E63;
50+
}
51+
52+
ul{
53+
list-style: none;
54+
}

0 commit comments

Comments
 (0)