-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest2.html
41 lines (32 loc) · 1.17 KB
/
test2.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/jquery-ui.js"></script>
<link rel="stylesheet" href="../js/smoothness.css">
<script>
myAction = {
type: "myTrigger",
message: "myTrigger fired.",
time: new Date()
}
function attachAction(e,a) {
// attatches an action to an element ... ^^
//$.event.trigger(a);
alert('the event is about to be atached...');
$.event.trigger(a);
}
window.onload=function(){
$("#content").append($("<button>").text('click me').click(function(){attachAction($(this),myAction)}));
$(document).on("myTrigger",function(evt){
$("#content :button ").text('STOP DOING THAT!');
console.log(evt);
});
}
</script>
</head>
<body>
<div id="content"/>
</body>
</html>