-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
23 lines (22 loc) · 786 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
document.querySelector('#push').onclick = function(){
if(document.querySelector('#newtask input').value.length == 0){
alert("Please Enter a Task")
}
else{
document.querySelector('#tasks').innerHTML += `
<div class="task">
<p id="taskname">
${document.querySelector('#newtask input').value}
</p>
<button type="button" class="btn-close" aria-label="Close"></button>
</div>
`;
//BUTTON DELETE
var delete_task = document.querySelectorAll(".btn-close");
for(var i=0; i< delete_task.length; i++){
delete_task[i].onclick = function(){
this.parentNode.remove();
}
}
}
}