-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
24 lines (20 loc) · 812 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
let buttonDOM = document.querySelector('#liveToastBtn')
let listTodoUlDOM = document.querySelector('.list-group')
addButton.addEventListener('onclick', newElement)
function newElement() {
if (document.querySelector('#task').value !== "") {
let todo = document.querySelector('#task').value
let liDOM = document.createElement("li")
liDOM.addEventListener('click', function() {
listTodoUlDOM.removeChild(liDOM)
$(".info").toast("show");
})
liDOM.innerHTML = ` ${todo} `
listTodoUlDOM.appendChild(liDOM)
localStorage.setItem(`Yapılacak : ${localStorage.length + 1}`, liDOM.innerText)
document.querySelector('#task').value = ""
$(".success").toast("show");
} else {
$(".error").toast("show");
}
}