-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDom-Events.js
More file actions
160 lines (91 loc) · 2.6 KB
/
Copy pathDom-Events.js
File metadata and controls
160 lines (91 loc) · 2.6 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
const filterInput = document.getElementById("filter")
const todoForm = document.getElementById("todo-form")
todoForm.addEventListener("submit",submitform)
function submitform(e){
console.log('Submit Eventi')
e.preventDefault()
}
/* filterInput.addEventListener("focus",function(e){
console.log(e)
console.log(e.type)
console.log(e.target)
console.log(e.target.placeholder)
console.log(e.target.className)
}) */
/*
filterInput.onfocus = function(){
console.log('Naber')
}
*/
console.log('Filter', filterInput)
// Keyboard Event
// Not : İnput alanından değer almak için e.target.value diyerek alabiliriz.
const header = document.querySelector(".card-header")
const todoInput = document.querySelector("#todo")
todoInput.addEventListener("keyup",changeText)
function changeText(e){
header.textContent = e.target.value
console.log(e.target.value)
}
// keypress Shift yukarı yön tuşları vb. görmüyor
/* document.addEventListener("keypress", run)
function run (e) {
// console.log(e.which)
console.log(e.key)
} */
// keydown Shift yukarı yön tuşları vb. görüyor
/* document.addEventListener("keydown", run)
function run (e) {
// console.log(e.which)
console.log(e.key)
} */
// keyup Tuşu bıraktığımız zaman çalışıyor
/* document.addEventListener("keyup", run)
function run (e) {
// console.log(e.which)
console.log(e.key)
} */
// Mouse Eventleri
const cardMain = document.querySelectorAll(".card-body")[1]
const title = document.querySelector("#tasks-title")
// Click Event
title.addEventListener("click",run)
// Double Click Evnet
title.addEventListener("dbclick",run)
// Mouse Down
title.addEventListener("mousedown",run)
// Mouse Up
title.addEventListener("mouseup",run)
// Mouse Over Elementin üzerine gelmemiz yeterli
title.addEventListener("mouseover",run)
// Mouse Out
title.addEventListener("mouseout",run)
cardMain.addEventListener("mouseover",run)
// Mouse Enter - Mouse Leave
cardMain.addEventListener("mouseenter",run)
function run(e){
console.log(e.type)
}
// Input Eventleri
const filter = document.getElementById("filter")
// Dom Loaded
document.addEventListener("DOMContentLoaded",load)
function load(e){
console.log('Sayfa Yüklendi')
}
// Focus
filter.addEventListener("focus",run)
// Blur
filter.addEventListener("blur",run)
// Paste
filter.addEventListener("paste")
// Copy
filter.addEventListener("copy",run)
// Cut
filter.addEventListener("cut",run)
// Select
filter.addEventListener("cut",run)
function run(e){
console.log(e.type)
}
// Event Capturing - Event Bubbling