-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent.html
More file actions
25 lines (25 loc) Β· 740 Bytes
/
event.html
File metadata and controls
25 lines (25 loc) Β· 740 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
// event html
<ul>
<li>my item</li>
<li>Lorem, ipsum.</li>
<li>Nostrum, enim!</li>
<li onclick="this.innerText='Some one clicked'">Tempore, fuga.</li>
<li onclick="itemClickHander(event)">Rerum, consequuntur.</li>
<li id="lastPerson">Mollitia, magnam?</li>
</ul>
<script>
function itemClickHander(event){
console.log(event.target.innerText)
}
document.getElementById('lastPerson').addEventListener('click', itemClickHander );
</script>
</body>
</html>