Skip to content

Commit ac0ebc4

Browse files
committed
todo list
1 parent 4b79a7a commit ac0ebc4

File tree

4 files changed

+133
-1
lines changed

4 files changed

+133
-1
lines changed

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1>Javascript-Challanges</h1>
2525
<a class="project-link" href="./File uploader/index.html">Project 4 - File Uploader 🤨</a>
2626
<a class="project-link" href="./Light-Dark Mode/index.html">Project 5 - Light & Dark Mode👻</a>
2727
<a class="project-link" href="./Meme generator/index.html">Project 6 - Meme Generator 🧠</a>
28-
<a class="project-link" href="./7-scroll/index.html">Project 7 - 👀</a>
28+
<a class="project-link" href="./todo-list/index.html">Project 7 -Todo-List 👀</a>
2929
<a class="project-link" href="./8-typer/index.html">Project 8 - 📚
3030
</a>
3131
<a class="project-link" href="./9-mouseCircle/index.html">Project 9 - 📚

todo-list/index.css

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
.nav-bar {
2+
display: flex;
3+
flex-wrap: wrap;
4+
align-items: center;
5+
justify-content: center;
6+
padding: 1rem;
7+
margin-bottom: 5px;
8+
gap: 1rem;
9+
border-bottom: solid 1px #aaa;
10+
background-color: #aaa;
11+
}
12+
13+
nav a {
14+
min-width: 9rem;
15+
border-radius: 0.3rem;
16+
border: solid black;
17+
background-color: aliceblue;
18+
text-align: center;
19+
text-decoration-line: none;
20+
padding: 5px;
21+
}
22+
23+
* {
24+
box-sizing: border-box;
25+
}
26+
.container{
27+
width: 80%;
28+
background-color: blueviolet;
29+
max-width: 80vh;
30+
display: grid;
31+
align-items: center;
32+
justify-content: center;
33+
margin: 100px auto 20px;
34+
}
35+
.todo-list{
36+
text-decoration: bold;
37+
margin: 0.5em;
38+
font-size: xx-large;
39+
}
40+
.input{
41+
margin: 0.2em 0 0.2em;
42+
border-radius: 0.4em;
43+
display: flex;
44+
align-items: center;
45+
justify-content: center;
46+
}
47+
input, .button{
48+
padding:0.5rem;
49+
}
50+
.task-container{
51+
margin: 0.2em 0 0.2em;
52+
padding: 0.5rem;
53+
display:grid;
54+
justify-content: center;
55+
}
56+
l{
57+
justify-content: space-between;
58+
margin: 0.1rem;
59+
padding: 0.1rem;
60+
background-color: aqua;
61+
}

todo-list/index.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>Todo-List</title>
8+
<link rel="stylesheet" href="index.css">
9+
</head>
10+
<body>
11+
<nav class="nav-bar">
12+
<a href="/index.html">Home</a>
13+
<a target="_blank" href="https://youtu.be/2s2sZm5gy-o?feature=shared">Youtube</a>
14+
<a target="_blank" href="https://github.com/RohitSharma50">Github</a>
15+
</nav>
16+
17+
<div class="container">
18+
<div class="todo-list">Todo-List</div>
19+
<div class="input">
20+
<input id="input-value" placeholder="Type Here">
21+
<button class="button">Add</button>
22+
</div>
23+
<div class="item-list">
24+
<ul class="task-container">
25+
<li> <input type="checkbox">Task 1 <button>Delete</button></li>
26+
<li><input type="checkbox">task 2 <button>Delete</button></li>
27+
</ul>
28+
<div id="show"></div>
29+
</div>
30+
</div>
31+
<script src="index.js" defer></script>
32+
33+
</body>
34+
</html>

todo-list/index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
3+
let addButton = document.querySelector('.button')
4+
5+
addButton.addEventListener('click', ()=>{
6+
7+
8+
let input_value= document.getElementById('input-value').value ;
9+
10+
if(input_value===""){alert('enter text')}
11+
else{
12+
let button = document.createElement('button');
13+
button.id='delete_btn';
14+
button.innerText='delete';
15+
16+
let div= document.createElement('div');
17+
div.class='new-div';
18+
div.innerText=input_value;
19+
let parent= document.querySelector('.container');
20+
21+
parent.appendChild(div);
22+
div.appendChild(button);
23+
24+
25+
let input= document.getElementById('input-value').value="" ;
26+
27+
28+
button.addEventListener('click', ()=>{
29+
div.remove();
30+
})
31+
}
32+
33+
})
34+
35+
36+
37+

0 commit comments

Comments
 (0)