-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweekSevenExample.js
More file actions
41 lines (29 loc) · 1.17 KB
/
weekSevenExample.js
File metadata and controls
41 lines (29 loc) · 1.17 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
// event listener oluşturma
button.addEventListener("click", ()=> {
if(inputElement.value.trim() !== ""){
const listItem = document.createElement("li")
listItem.style.backgroundColor = "#f0f0f0"
listItem.style.padding="8px"
listItem.style.display ="flex"
listItem.style.justifyContent ="space-between"
listItem.style.width = "400px"
const textSpan = document.createElement("span")
textSpan.style.fontSize ="12px"
textSpan.textContent = inputElement.value
const deleteButton = document.createElement("button")
deleteButton.textContent ="Sil"
deleteButton.style.backgroundColor ="red"
deleteButton.style.color ="white"
deleteButton.style.cursor ="pointer"
deleteButton.onclick = () => listItem.remove()
listItem.appendChild(textSpan)
listItem.appendChild(deleteButton)
userList.appendChild(listItem)
inputElement.value =""
}
})
formContainer.appendChild(label)
formContainer.appendChild(inputElement)
formContainer.appendChild(button)
formContainer.appendChild(userList)
document.body.appendChild(formContainer)