forked from behappyyoung/javascriptsamplecodes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent_test.html
More file actions
56 lines (46 loc) · 987 Bytes
/
event_test.html
File metadata and controls
56 lines (46 loc) · 987 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
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
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="jQuery event" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<meta charset=utf-8 />
<title>jQuery event</title>
<style id="jsbin-css">
</style>
</head>
<body>
<table id="table">
<tr>
<td>fdsfasd </td>
<td>fdsfasd </td>
<td>
<div>
<div>
<div id='inner'>
test
</div>
</div>
</div>
</td>
</tr>
<tr>
<td>fdsfasd </td>
<td>fdsfasd </td>
</tr>
</table>
<div id="log">
</div>
<script>
$('#inner').on('click', function(e){
console.log('td');
$('#log').css('color', 'red');
$('#log').html($('#log').html() + 'td clicked');
});
$('table').on('click', function(e){
console.log('table');
$('#log').css('color', 'black');
$('#log').html($('#log').html() + 'table clicked');
});
</script>
</body>
</html>