Skip to content

Learn Js DOM Manipulation with To-do App #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
24 changes: 24 additions & 0 deletions Tasks List/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Task Viewer</title>
</head>
<body>

<h1>Task</h1>
<div class="container">
<input type="text" id="inputField">
<button id="addToDo">+</button>

<div class="to-dos" id="toDoContainer">
</div>
</div>


<script src="index.js"></script>
</body>
</html>
20 changes: 20 additions & 0 deletions Tasks List/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var inputField = document.getElementById('inputField')
var addToDo = document.getElementById('addToDo')
var toDoContainer = document.getElementById('toDoContainer')

addToDo.addEventListener('click',function(){
var data = inputField.value
var paragraph = document.createElement('p')
paragraph.innerText = data
paragraph.classList.add('paragraph-styling')
toDoContainer.append(paragraph)
inputField.value = ''

paragraph.addEventListener('click', function(){
paragraph.style.textDecoration = "line-through"
})

paragraph.addEventListener('dblclick', function(){
toDoContainer.removeChild(paragraph)
})
})
57 changes: 57 additions & 0 deletions Tasks List/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
html, body{
width: 50%;
margin: 0 auto;
background-color: #0a192f;
color: white;
font-family: Arial, Helvetica, sans-serif;
}

.container{
width: 400px;
}

#inputField{
width: 300px;
height: 46px;
border-width: 0;
font-size: 1.4rem;
vertical-align: middle;

border: 2px solid rgba(77, 181, 255, 0.4);
outline: none;
background-color: transparent;
border-radius: 0.5rem;
color: white;
padding-left: 1rem;
}

#addToDo{
width: 50px;
height: 50px;
margin-left: 8px;
border-radius: 0.5rem;
vertical-align: middle;
font-size: 30px;
cursor: pointer;
border: 2px solid rgba(77, 181, 255, 0.4);
background-color: transparent;
color: white;
}
.paragraph-styling{
margin: 10;
cursor: pointer;
font-size: 20px;
background-color: #64ffda;
border-radius: 0.4rem;
color: black;
padding: 1.1rem;
transition: all 0.5s ease;
}

.paragraph-styling:hover{
transform: scale(1.05);
}

.to-dos{
margin-top: 25px;
}