-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
29 lines (24 loc) · 772 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
24
25
26
27
28
29
const addButton = document.getElementById('addTodo');
const todoContainer = document.getElementById('todoContainer');
const inField = document.getElementById('inField');
//Event
addButton.addEventListener('click',
// add data with create paragraph
() => {
const paragraph = document.createElement('p');
paragraph.classList.add('para');
paragraph.style.backgroundColor = 'yellow';
paragraph.innerText = inField.value;
todoContainer.appendChild(paragraph);
inField.value = "";
// erase data of your list
paragraph.addEventListener('click',
() => {
paragraph.style.textDecoration = 'line-through';
})
// delete
paragraph.addEventListener('dblclick',
() => {
paragraph.remove()
})
})